s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
int64
0
100
memory
stringlengths
4
6
code_size
int64
15
14.7k
code
stringlengths
15
14.7k
problem_id
stringlengths
6
6
problem_description
stringlengths
358
9.83k
input
stringlengths
2
4.87k
output
stringclasses
807 values
__index_level_0__
int64
1.1k
1.22M
s058412156
p00103
u548252256
1560948561
Python
Python3
py
Accepted
20
5584
364
if __name__ == '__main__': n = int(input()) ocnt = 0 hcnt = 0 score = 0 while n > 0: line = input() if line == "HOMERUN": score += hcnt score += 1 hcnt = 0 elif line == "HIT": hcnt += 1 if hcnt == 4: score += 1 hcnt = 3 else: ocnt += 1 if ocnt == 3: print(score) ocnt...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,487
s076930949
p00103
u477023447
1560851640
Python
Python3
py
Accepted
20
5600
991
# -*- coding: utf-8 -*- class Baseball: def __init__(self, score, first, second, third, out_counter): self.score = score self.first = first self.second = second self.third = third self.out_counter = out_counter def hit(self): if self.third == 1: self.score += 1 if self.second == ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,488
s932007650
p00103
u345188151
1553502675
Python
Python
py
Accepted
10
4668
534
n = int(raw_input()) ining = 0 out = 0 score = 0 fst = sec = thr = 0, 0, 0 while ining < n: val = raw_input() if val == 'HIT': if thr == 1: score += 1 thr = 0 thr = sec sec = fst fst = 1 if val == 'HOMERUN': if thr == 1: score += 1 if sec == 1: score += 1 if...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,489
s560030837
p00103
u990228206
1551758844
Python
Python3
py
Accepted
20
5584
381
n=int(input()) for i in range(n): runner=0 out=0 score=0 while 1: state=input() if state=="HIT": if runner<3: runner+=1 else: score+=1 elif state=="HOMERUN": score+=runner+1 runner=0 else: ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,490
s503009854
p00103
u051394180
1549303172
Python
Python
py
Accepted
10
4676
691
def get_event(event, ranner, o_cnt): s_cnt = 0 if event == 'HIT': s_cnt = ranner.pop(0) # [1 1 0 ] to [1 0 1] ranner.append(1) elif event == 'HOMERUN': s_cnt = sum(ranner) + 1 ranner = [0, 0, 0] elif event == 'OUT': o_cnt += 1 return (s_cnt, o_cnt, ranner) ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,491
s065142407
p00103
u553148578
1547703250
Python
Python3
py
Accepted
20
5584
310
for i in range(int(input())): b1 = b2 = b3 = out = score = 0 while 1: n = input() if n == "HIT": if b3 > 0 : score += 1; b3 = b2; b2 = b1; b1 = 1; elif n == "HOMERUN": score += b1 + b2 + b3 + 1; b1 = b2 = b3 = 0 elif n == "OUT": out += 1; if out >=3: break print(score)
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,492
s484412842
p00103
u717526540
1543219599
Python
Python3
py
Accepted
20
5592
698
n = int(input()) cnt = 0 while 1: if cnt == n: break runner = [0] * 3 score = 0 outcount = 0 while outcount != 3: event = input() if event == "HIT": if runner[2]: score += 1 runner[2] = 0 if runner[1]: ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,493
s701356429
p00103
u024715419
1542254447
Python
Python3
py
Accepted
20
5600
396
n = int(input()) for i in range(n): b = [False,False,False] o = 0 p = 0 while o < 3: e = input() if e == "HIT": if b[2]: p += 1 b[1], b[2] = b[0], b[1] b[0] = True elif e == "HOMERUN": p += b.count(True) + 1 ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,494
s335048073
p00103
u219940997
1539002999
Python
Python3
py
Accepted
20
5600
345
n = int(input()) cnt, hit, out = 0, 0, 0 while n != 0: s = input() if s == 'HIT': hit += 1 if hit == 4: cnt += 1 hit -= 1 elif s == 'HOMERUN': cnt += hit + 1 hit = 0 else: out += 1 if out == 3: print(cnt) cnt, hit, out =...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,495
s336854412
p00103
u525366883
1538195216
Python
Python3
py
Accepted
20
5592
596
A = B = 0 team = "A" n = int(input()) for i in range(n): cnt = b1 = b2 = b3 = out = 0 while out != 3: s = input() if s == "HIT": if b3 == 1: cnt+=1 b1,b2,b3 = 1,b1,b2 elif s == "HOMERUN": cnt+=b1+b2+b3+1 b1 = b2 = b3 = 0 ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,496
s979013275
p00103
u316584871
1537083960
Python
Python3
py
Accepted
20
5604
445
n = int(input()) for i in range(n): out = 0 cnt = 0 ro = [0for i in range(3)] while True: o = str(input()) if (o == 'HIT'): cnt += ro[2] ro = [1] + ro[:2] elif (o == 'OUT'): out += 1 elif (o == 'HOMERUN'): cnt += (sum(ro)+1)...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,497
s498369590
p00103
u103916545
1536163937
Python
Python3
py
Accepted
20
5592
498
n = int(input()) for i in range(n): p = 0 out = 0 x = i % 2 state = [0,0,0] while True: s = str(input()) if s == "HIT": if state[0] == 1: p += 1 state[0],state[1],state[2] = state[1],state[2],1 elif s == "HOMERUN": point = ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,498
s793733001
p00103
u319725914
1533967033
Python
Python3
py
Accepted
20
5588
393
n = int(input()) for i in range(n): no = 0 np = 0 tm = 0 while(True): s = input() if s == "HIT": tm += 1 if tm >= 4: np += 1 tm = 3 if s == "HOMERUN": np += tm +1 tm = 0 if s == "OUT": ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,499
s467508025
p00103
u539753516
1532474626
Python
Python3
py
Accepted
20
5592
507
for inning in range(int(input())): out=0 runner=[0]*4 while out<3: event=input() if event=="HIT": for i in range(3,0,-1): runner[i]+=runner[i-1] runner[i-1]=0 runner[0]=1 elif event=="HOMERUN": runner[3]+=1 ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,500
s215784169
p00105
u899060994
1409301122
Python
Python
py
Accepted
10
4208
364
dic = {} while True: try: word, page = map(str,raw_input().split()) if word in dic: dic[word].append(int(page)) else: dic[word] = [int(page)] except: for word in sorted(dic): print word for page in sorted(dic[word]): ...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,583
s667127590
p00105
u912237403
1414592134
Python
Python
py
Accepted
10
4192
187
import sys d={} for s in sys.stdin: w,p=s.split() if w in d: d[w].append(int(p)) else: d[w]=[int(p)] for w in sorted(d.keys()): print w print " ".join(map(str,sorted(d[w])))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,584
s209266455
p00105
u912237403
1414592400
Python
Python
py
Accepted
20
4200
187
import sys d={} for s in sys.stdin: w,p=s.split() if w in d: d[w].append(int(p)) else: d[w]=[int(p)] for w,x in sorted(d.items()): print w print " ".join(map(str,sorted(x)))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,585
s383688403
p00105
u408260374
1417268653
Python
Python3
py
Accepted
30
6716
435
d = {} while True: try: w, n = input().split() n = int(n) temp = d.get(w, []) temp.append(n) d[w] = temp except: key = list(d.keys()) key.sort() for k in key: print(k) d[k].sort() for n in range(len(d[k])): ...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,586
s465127195
p00105
u408260374
1417269334
Python
Python3
py
Accepted
30
6720
262
d = {} while True: try: w, n = input().split() n = int(n) if w in d: d[w].append(n) else: d[w] = [n] except: for k in sorted(d): print(k) print(" ".join(map(str,sorted(d[k])))) break
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,587
s827302839
p00105
u879226672
1423728317
Python
Python
py
Accepted
10
4204
339
dic = {} while True: try: word,PageNum = raw_input().split() if word not in dic: dic[word] = [] dic[word].append(int(PageNum)) else: dic[word].append(int(PageNum)) except: break for k,v in sorted(dic.items()): print k print " ".join(...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,588
s628294792
p00105
u744114948
1428307310
Python
Python3
py
Accepted
30
6716
320
#!/usr/bin/env python3 d = {} while True: try: w, p = input().split() except: break try: d[w].add(int(p)) except: d[w] = set() d[w].add(int(p)) l = list(d.keys()) l.sort() for i in l: print(i) a = list(d[i]) a.sort() print(" ".join(map(str, a)))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,589
s428307148
p00105
u145563629
1431234801
Python
Python
py
Accepted
20
4220
314
dic = {} while 1: try: name, page = raw_input().split() page = int(page) if dic.get(name): dic[name] += [page] else: dic[name] = [page] except: break dic = sorted(dic.items()) for name, page in dic: page.sort() print name for i in range(len(page) - 1): print page[i], print page[-1]
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,590
s407294841
p00105
u379499530
1432112801
Python
Python
py
Accepted
10
4204
307
dict = {} while True: try: word, page = raw_input().split() if dict.has_key(word): dict[word].append(int(page)) else: dict[word] = [int(page)] except: break for k, v in sorted(dict.items()): print k print " ".join(map(str, sorted(v)))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,591
s077254344
p00105
u873482706
1435152958
Python
Python
py
Accepted
20
4200
265
import sys dic = {} for line in sys.stdin: s, p = line.rstrip().split(' ') if not s in dic: dic[s] = [p] else: dic[s].append(p) else: for k, v in sorted(dic.items()): v.sort(key=int) print k print ' '.join(v)
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,592
s395451447
p00105
u489809100
1447660310
Python
Python
py
Accepted
10
6236
326
dict = {} while True: try: a,b = map(str,raw_input().split()) except EOFError: break if a in dict: dict[a].append(int(b)) else: dict[a] = [int(b)] for var in dict: dict[var].sort() dic = list(dict.keys()) dic.sort() for var in dic: print var for i in xrange(len(dict[var])): print dict[var][i], ...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,593
s115345905
p00105
u775586391
1451537705
Python
Python3
py
Accepted
20
7620
272
d = {} l = [] while True: try: s,n = input().split() if s in d: d[s].append(int(n)) else: d[s] = [int(n)] l.append(s) except: break l.sort() for s in l: print(s) d[s].sort() d[s] = [str(s) for s in d[s]] print(' '.join(d[s]))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,594
s933717980
p00105
u766163292
1451740105
Python
Python3
py
Accepted
40
8052
492
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import array import bisect import collections import sys if __name__ == "__main__": pre_dict = collections.defaultdict(lambda: array.array("I")) for line in sys.stdin: [word, page0] = line.split() page = int(page0) bisect.insort(pre_dict[...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,595
s810001581
p00105
u140201022
1461519883
Python
Python
py
Accepted
20
6392
299
s={} j=[] while 1: try: n,k=map(str,raw_input().split()) if s.has_key(n): s[n].append(int(k)) else: s[n]=[int(k)] j.append(n) except: break j.sort() for i in j: print i s[i].sort() print ' '.join(map(str,s[i]))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,596
s612489829
p00105
u203261375
1466296190
Python
Python3
py
Accepted
30
7680
374
import sys dic = {} for s in sys.stdin: arr = s.split() if arr[0] in dic: a = dic[arr[0]] dic[arr[0]] = a + [int(arr[1])] else: dic[arr[0]] = [int(arr[1])] for i in sorted(dic): print(i) a = sorted(dic[i]) for j in range(len(a)): if j != len(a)-1: prin...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,597
s569304267
p00105
u160041984
1468335068
Python
Python3
py
Accepted
20
7628
319
import sys def line():return sys.stdin.readline().strip() I = {} while True: try: a,b = line().split() b = int(b) if a in I: I[a].append(b) else: I[a] = [b] except: break for k in sorted(I): print(k) print(" ".join(map(str,sorted(I[k]))))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,598
s863980537
p00105
u755162050
1468838603
Python
Python3
py
Accepted
30
7624
508
def main(): book_index = {} while True: try: word, page = input().split(' ') page = int(page) page_list = book_index.get(word) if page_list: page_list.append(page) else: book_index[word] = [page] except E...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,599
s410191443
p00105
u755162050
1468838896
Python
Python3
py
Accepted
30
7580
396
book_index = {} while True: try: word, page = input().split(' ') page = int(page) page_list = book_index.get(word) if page_list: page_list.append(page) else: book_index[word] = [page] except Exception: break for k in sorted(book_index.keys...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,600
s251403114
p00105
u589886885
1472207709
Python
Python3
py
Accepted
20
7564
225
import sys d = {} for i in sys.stdin.readlines(): s, n = i.split() if s in d: d[s].append(int(n)) else: d[s] = [int(n)] d = sorted(d.items()) for i in d: print(i[0]) print(*sorted(i[1]))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,601
s335571811
p00105
u500396695
1478004462
Python
Python3
py
Accepted
40
7532
316
import sys dictionary = {} for i in sys.stdin.readlines(): word, page = i.split() if word in dictionary: dictionary[word].append(int(page)) else: dictionary[word] = [int(page)] dictionary = sorted(dictionary.items()) #??????????????????????????? for i in dictionary: print(i[0]) #?????? print(*sorted(i[1]))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,602
s906039806
p00105
u546285759
1479466502
Python
Python3
py
Accepted
20
7596
299
dic = {} while True: try: word, pgn = input().split() if word in dic.keys(): dic[word].append(int(pgn)) else: dic[word] = [int(pgn)] except: break for k, v in sorted(dic.items()): print(k) print(' '.join(map(str, sorted(v))))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,603
s768442110
p00105
u301729341
1481765198
Python
Python3
py
Accepted
20
7536
600
Date_lis = [] W_lis = [] while True: try: s,n = map(str,input().split()) if s in W_lis: Date_lis[W_lis.index(s)][1].append(int(n)) else: Date_lis.append([s,[int(n)]]) W_lis.append(s) except : Date_lis = sorted(Date_lis) for i ...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,604
s811011720
p00105
u078042885
1483685649
Python
Python3
py
Accepted
20
7588
256
c={} while 1: try: a,b=input().split() if a in c.keys():c[a].append(int(b)) else: c[a]=[int(b)] except: for i,j in sorted(c.items()): print(i) print(' '.join(map(str,sorted(j)))) break
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,605
s951421794
p00105
u078042885
1483686792
Python
Python3
py
Accepted
20
7552
231
c={} while 1: try: a,b=input().split() if a in c:c[a].append(int(b)) else: c[a]=[int(b)] except: for i,j in sorted(c.items()): print(i) print(*sorted(j)) break
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,606
s836474998
p00105
u711765449
1485271832
Python
Python3
py
Accepted
20
7668
432
data = [] while True: try: data.append(input()) except EOFError: break d = {} for i in range(len(data)): i,n = data[i].split() if i in d: d[i].append(n) else: d[i] = [n] d = sorted(d.items(), key = lambda x:x[0]) for i in range(len(d)): i,n = d[i] n = map(int...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,607
s801474886
p00105
u462831976
1494164500
Python
Python3
py
Accepted
30
7960
332
# -*- coding: utf-8 -*- import sys import os from collections import defaultdict d = defaultdict(list) for s in sys.stdin: lst = s.split() word = lst[0] page = int(lst[1]) d[word].append(page) keys = list(d.keys()) keys.sort() for key in keys: print(key) pages = d[key] pages.sort() p...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,608
s914188878
p00105
u919202930
1500527063
Python
Python3
py
Accepted
30
7604
304
index = {} while True: try: word,page = input().split() page = int(page) index[word].append(page) except KeyError: index[word] = [page] except EOFError: break for (key,value) in sorted(index.items()): print(key) value = list(map(str,sorted(value))) print(" ".join(value))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,609
s168774459
p00105
u503263570
1502045782
Python
Python3
py
Accepted
30
7640
175
import sys a={} for i in sys.stdin: b,c=i.split() a.setdefault(b, []).append(c) for a,b in sorted(a.items(), key=lambda x: x[0]): print(a) print(*sorted(map(int,b)))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,610
s638689428
p00105
u546285759
1502431931
Python
Python3
py
Accepted
30
7648
255
d = {} while True: try: word, page = input().split() page = int(page) except: break d[word] = [page] if word not in d else d[word] + [page] for word, pages in sorted(d.items()): print(word) print(*sorted(pages))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,611
s747876311
p00105
u811733736
1504242877
Python
Python3
py
Accepted
20
7516
716
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0105&lang=jp """ import sys def compile_index(dict, word, page): if word in dict: temp = dict[word] temp.append(page) temp.sort() dict[word] = temp else: temp = [page] dict[word...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,612
s068031042
p00105
u957021183
1505294067
Python
Python3
py
Accepted
20
7764
433
# Aizu Problem 0105: Book Index # import sys, math, os # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") index = {} for line in sys.stdin: word, page = line.split() if word not in index: index[word] = [] index[word].append(int(page)) f...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,613
s132309217
p00105
u742505495
1510282280
Python
Python3
py
Accepted
20
7644
435
import sys dic = {} while True: try: a,b = map(str,input().split()) page = int(b) if a not in dic: dic[a] = [page] else: dic[a].append(page) except EOFError: names = sorted(dic.keys()) for i in range(len(names)): print(names[i]) pages = sorted(dic[names[i]]) for j in range(len(pages)): ...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,614
s246953384
p00105
u742178809
1511764872
Python
Python3
py
Accepted
20
7636
438
import sys #from me.io import dup_file_stdin #@dup_file_stdin def solve(): index = dict() for line in sys.stdin: word,page = line.split(' ') pages = index.get(word,list()) pages.append(int(page)) index[word] = pages keys = list(index.keys()) keys.sort() for key in ke...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,615
s509060538
p00105
u009288816
1515209004
Python
Python
py
Accepted
10
4688
537
import sys l = [] for input in sys.stdin: l.append(input.split()) l = sorted(l) for i in range(0,len(l)-1): for j in range(i+1,len(l)): if(l[i][0] == l[j][0]): l[i].append(l[j][1]) res = [] for i in range(0,len(l)): if(l[i][0] == l[i-1][0]): continue res.append(l[i]) for i i...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,616
s666266486
p00105
u546285759
1515905705
Python
Python3
py
Accepted
20
5608
304
d = {} while True: try: data = input().split() except: break word = data[0] number = int(data[1]) if word in d: d[word].append(number) else: d[word] = [number] for k, v in sorted(d.items(), key=lambda x: x[0]): print(k) print(*sorted(v))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,617
s990460140
p00105
u808429775
1516368493
Python
Python3
py
Accepted
20
5608
487
import sys dictionary = {} for line in sys.stdin: line = line[:-1] word, page = line.split(" ") page = int(page) if word in dictionary: dictionary[word].append(page) else: dictionary[word] = [page] keys = list(dictionary) keys.sort() output = [] for key in keys: output.app...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,618
s897484972
p00105
u150984829
1517484011
Python
Python3
py
Accepted
20
5612
139
import sys d={} for e in sys.stdin: k,v=e.split() d.setdefault(k,[]) d[k]+=[int(v)] for k in sorted(d): print(k) print(*sorted(d[k]))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,619
s785319497
p00105
u150984829
1517484165
Python
Python3
py
Accepted
20
5616
149
import sys d={} for e in sys.stdin: k,v=e.split() if k in d:d[k]+=[int(v)] else:d[k]=[int(v)] for k in sorted(d): print(k) print(*sorted(d[k]))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,620
s878667486
p00105
u150984829
1517484196
Python
Python3
py
Accepted
20
5616
142
import sys d={} for e in sys.stdin: k,v=e.split() if k not in d:d[k]=[] d[k]+=[int(v)] for k in sorted(d): print(k) print(*sorted(d[k]))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,621
s649300110
p00105
u150984829
1517484302
Python
Python3
py
Accepted
20
5616
138
import sys d={} for e in sys.stdin: k,v=e.split() d.setdefault(k,[]).append(int(v)) for k in sorted(d): print(k) print(*sorted(d[k]))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,622
s287991717
p00105
u043254318
1521218760
Python
Python3
py
Accepted
30
5620
730
def get_input(): while True: try: yield ''.join(input()) except EOFError: break N = list(get_input()) N.sort() N1,N2 = N[0].split() word = N1 pnum = [] pnum.append(int(N2)) for l in range(1, len(N)): N1,N2 = N[l].split() if word != N1: print(word) ...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,623
s805908267
p00105
u352394527
1527651147
Python
Python3
py
Accepted
20
5612
230
dic = {} while True: try: s, i = input().split() if s in dic: dic[s].append(int(i)) else: dic[s] = [int(i)] except EOFError: break for k, v in sorted(dic.items()): print(k) print(*sorted(v))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,624
s047904746
p00105
u136916346
1528419676
Python
Python3
py
Accepted
20
5616
240
import sys l=[i.split() for i in sys.stdin] d={} for i in l: if i[0] not in d: d[i[0]]=[i[1]] else: d[i[0]].append(i[1]) for i in sorted(d.keys()): print(i) d[i]=list(map(int,d[i])) print(" ".join(map(str,sorted(d[i]))))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,625
s172409937
p00105
u847467233
1529190911
Python
Python3
py
Accepted
30
5992
302
# AOJ 0105 Book Index # Python3 2018.6.17 bal4u from collections import defaultdict index = defaultdict(list) while True: try: w, p = list(input().split()) except EOFError: break index[w].append(p) index = dict(sorted(index.items())) for x in index: print(x) print(*sorted(map(int, index[x])))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,626
s851861838
p00105
u724947062
1347273347
Python
Python
py
Accepted
20
5396
336
import sys dictionary = dict() for line in sys.stdin.readlines(): line = line.strip() word, num = line.split() if not dictionary.has_key(word): dictionary[word] = list() dictionary[word].append(int(num)) for key in sorted(dictionary.keys()): print key print " ".join(map(str, sorted(di...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,627
s058447462
p00105
u779627195
1354652663
Python
Python
py
Accepted
20
4228
352
import sys R = lambda:map(int,raw_input().split()) d = {} while 1: try: s,p = raw_input().split() p = int(p) if not d.has_key(s): d[s] = set() d[s].add(p) except EOFError: break #print d for k in sorted(d.iterkeys()): print k print " ".jo...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,628
s837061457
p00105
u460331583
1355932126
Python
Python
py
Accepted
20
4236
341
hoge = {} ; teki=[] while True: try: a,b = raw_input().split() if a not in hoge: hoge[a] = [int(b)] elif a in hoge: hoge[a].append(int(b)) except EOFError: for j in sorted(hoge): print j ans = len(hoge[j]) aaa =sorted(hoge[j]) for i in range(ans): print aaa[i], ...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,629
s919571385
p00105
u894941280
1355932153
Python
Python
py
Accepted
20
4236
341
hoge = {} ; teki=[] while True: try: a,b = raw_input().split() if a not in hoge: hoge[a] = [int(b)] elif a in hoge: hoge[a].append(int(b)) except EOFError: for j in sorted(hoge): print j ans = len(hoge[j]) aaa =sorted(hoge[j]) for i in range(ans): print aaa[i], ...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,630
s375098080
p00105
u290605490
1356013290
Python
Python
py
Accepted
10
8788
340
from collections import defaultdict dic=defaultdict(list) while True: try: word,page=raw_input().split() dic[word].append(int(page)) except EOFError: break; for word in sorted(dic): print word dic[word].sort() for i in range(len(dic[word])-1): print dic[word][i], ...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,631
s653570324
p00105
u290605490
1356013829
Python
Python
py
Accepted
10
8788
295
from collections import defaultdict dic=defaultdict(list) while True: try: w,p=raw_input().split() dic[w].append(int(p)) except EOFError: for w in sorted(dic): print w dic[w].sort() print " ".join(map(str,dic[w])) break
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,632
s910732289
p00105
u665962315
1357434788
Python
Python
py
Accepted
20
4232
343
idx = {} while True: try: data = raw_input().split(); if data[0] in idx: idx[data[0]].append(int(data[1])) else: idx[data[0]] = [int(data[1])] except (EOFError): break for word in sorted(list(idx)): print word for page in sorted(idx[word]): ...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,633
s694126491
p00105
u647766105
1357451691
Python
Python
py
Accepted
20
4612
218
import sys,collections dic=collections.defaultdict(list) for line in sys.stdin.readlines(): w,p=line.strip().split() dic[w].append(p) for w in sorted(dic): print w print " ".join(sorted(dic[w],key=int))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,634
s081980281
p00105
u577457452
1361631476
Python
Python
py
Accepted
20
4608
243
import collections d = collections.defaultdict(list) while 1: try: w, p = raw_input().split() d[w].append(int(p)) except EOFError: break for w in sorted(d): print w print ' '.join(map(str, sorted(d[w])))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,635
s227382416
p00105
u542421762
1370167602
Python
Python
py
Accepted
20
4224
334
import sys index = {} for line in sys.stdin: word, page_num = tuple(line.rstrip('\n').split(' ')) if word in index: index[word].append(int(page_num)) else: index[word] = [int(page_num)] for k in sorted(index.keys()): print k pages = index[k] pages.sort() print ' '.join(ma...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,636
s815413949
p00105
u454358619
1377430384
Python
Python
py
Accepted
10
4608
274
from collections import defaultdict dic=defaultdict(list) while True: try: w,p=raw_input().split() dic[w].append(int(p)) except EOFError: for w in sorted(dic): print w dic[w].sort() print " ".join(map(str,dic[w])) break
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,637
s257858538
p00105
u865312527
1380558815
Python
Python
py
Accepted
20
4220
250
import sys ans = {} for x in sys.stdin.readlines(): word, page = x.rstrip().split() ans.setdefault(word,[]) ans[word].append(page) for k in sorted(ans.keys()): print k print " ".join(sorted(ans[k], cmp=lambda a,b: int(a)-int(b)))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,638
s464335644
p00105
u782850731
1382364155
Python
Python
py
Accepted
10
4608
412
#!/usr/bin/env python from __future__ import division, print_function from sys import stdin, exit from collections import defaultdict def main(): index = defaultdict(list) for line in stdin: word, page = line.split() index[word].append(int(page)) for word in sorted(index): print(...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,639
s828437153
p00105
u633068244
1394008021
Python
Python
py
Accepted
10
4208
233
index = {} while True: try: w, p = map(str, raw_input().split()) index.setdefault(w,[]).append(int(p)) except: break for k,v in sorted(index.items()): print k print " ".join(map(str, sorted(v)))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,640
s738288271
p00105
u193025715
1398245821
Python
Python
py
Accepted
10
4212
301
dic = {} while True: try: word, page = raw_input().split() if word in dic.keys(): dic[word].append(int(page)) dic[word].sort() else: dic[word] = [int(page)] except: dic = sorted(dic.items(), key=lambda x: x[0]) for d in dic: print d[0] print " ".join(map(str, d[1])) break
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,641
s069448047
p00105
u770042163
1596379688
Python
Python3
py
Accepted
30
5612
331
dic = {} while True: try: key,num = input().split() dic.setdefault(key,[]).append(int(num)) except: break dic = sorted(dic.items()) for tup in dic: print(tup[0]) tup[1].sort() for i in tup[1]: if i != tup[1][-1]: print(i,end=" ") else: ...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,642
s229439011
p00105
u240091169
1590730578
Python
Python3
py
Accepted
20
5620
468
book = [] while True : try : A = list(input().split()) except EOFError : break new_word = "ON" for i in range(len(book)) : if A[0] in book[i] : book[i].append(A[1]) new_word = "OFF" if new_word == "ON" : book.append([A[0], A[1]]) book...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,643
s428972133
p00105
u260980560
1588637859
Python
Python3
py
Accepted
20
5616
170
D = {} for line in open(0).readlines(): w, p = line.split() D.setdefault(w, []).append(int(p)) for k, v in sorted(D.items()): print(k) print(*sorted(v))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,644
s564022202
p00105
u630911389
1584353791
Python
Python3
py
Accepted
20
5624
364
dic = {} while(1): try: key,word = (x for x in input().split()) dic.setdefault(key, []) dic[key].append(word) except: break for k in sorted(dic.keys()): print(k) arr = sorted(dic[k],key=int) for i in range(0,len(arr)): if i != 0: print(" ",end=""...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,645
s608531833
p00105
u803862921
1571632151
Python
Python3
py
Accepted
20
5612
264
d = dict() while True: try: w, n = input().split() except: break n = int(n) if d.get(w): d[w].append(n) else: d[w] = [] d[w].append(n) for k in sorted(d.keys()): print(k) print( *sorted(d[k]) )
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,646
s713310450
p00105
u824708460
1568771195
Python
Python3
py
Accepted
20
5608
234
book = {} while 1: try: s, n = input().split() book.setdefault(s, []).append(int(n)) except: break book = dict(sorted(book.items())) for k, v in book.items(): print(k) v.sort() print(*v)
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,647
s750920041
p00105
u314166831
1563987996
Python
Python3
py
Accepted
20
5728
2,999
# coding=utf-8 ### ### for python program ### import sys import math # math class class mymath: ### pi pi = 3.14159265358979323846264338 ### Prime Number def pnum_eratosthenes(self, n): ptable = [0 for i in range(n+1)] plist = [] for i in range(2, n+1): if ptable...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,648
s871707608
p00105
u051789695
1562767533
Python
Python3
py
Accepted
20
5620
343
w=[] while True: try: s,n=input().split() except: break ch=True for i in range(len(w)): if w[i][0]==s: w[i].append(int(n)) ch=False break if ch: w.append([s,int(n)]) w.sort() for i in range(len(w)): print(w[i][0]) p=sorted(w...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,649
s128615709
p00105
u647694976
1561382935
Python
Python3
py
Accepted
20
5612
219
dic = {} while True: try: s, i = input().split() if s in dic:dic[s].append(int(i)) else:dic[s] = [int(i)] except:break for k, v in sorted(dic.items()): print(k) print(*sorted(v))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,650
s922452947
p00105
u548252256
1560951483
Python
Python3
py
Accepted
20
5616
253
if __name__ == '__main__': dic = {} while True: try: s,n = input().split() dic.setdefault(s,[]).append(int(n)) except EOFError: break # print(dic) tmp = sorted(list(dic)) for word in tmp: print(word) print(*sorted(dic[word]))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,651
s762700027
p00105
u371539389
1558438961
Python
Python3
py
Accepted
20
5604
336
index={} while True: try: word,page=input().split(" ") page=int(page) tmp=index.get(word,[]) tmp.append(page) index[word]=tmp except EOFError: break index=sorted(index.items()) for object in index: print(object[0]) print(" ".join([str(i) for i in sorted...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,652
s268920855
p00105
u990228206
1553662863
Python
Python3
py
Accepted
20
5604
453
key_list=[] page_list=[] while 1: try: key,page=map(str,input().split()) if key in key_list: page_list[key_list.index(key)].append(int(page)) else: key_list.append(key) page_list.append([int(page)]) except:break key_list_sort=key_list[:] key_list_sort....
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,653
s679002376
p00105
u717526540
1543222695
Python
Python3
py
Accepted
20
5612
312
dic = {} while 1: try: word, page = map(str, input().split()) page = int(page) if word in dic: dic[word].append(page) else: dic[word] = [page] except: break for d in sorted(dic): print(d) print(' '.join(map(str, sorted(dic[d]))))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,654
s157297857
p00105
u024715419
1542258302
Python
Python3
py
Accepted
30
5608
268
d = {} while True: try: w, p = input().split() if w in d: d[w].append(int(p)) else: d[w] = [int(p)] except: break for k in sorted(d.items(), key=lambda x: x[0]): print(k[0]) print(*sorted(k[1]))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,655
s504773585
p00105
u219940997
1539004516
Python
Python3
py
Accepted
20
5600
317
result = {} while True: try: n = input() except: break word, number = n.split() if word in result: result[word].append(number) else: result[word] = [number] for k, v in sorted(result.items()): val = sorted(list(map(int, v))) print(k + '\n' + ' '.join(map(str, val)))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,656
s759696854
p00105
u525366883
1538221836
Python
Python3
py
Accepted
20
5608
329
book = {} while True: a = b = 0 try: a, b = input().split() b = int(b) if a in book: book[a].append(b) else: book[a] = [b] except: break for i, m in sorted(book.items(), key = lambda x: x[0]): print(i) print(" ".join(str(j) for j in sor...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,657
s652902455
p00105
u316584871
1537851555
Python
Python3
py
Accepted
20
5612
380
book = {} while True: try: w, n = input().split() w = str(w).lower() n = int(n) if (w not in book.keys()): book[w] = [n] else: book[w] += [n] except EOFError: break W = [] for w, nlist in book.items(): nlist.sort() W.appen...
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,658
s206656574
p00105
u319725914
1533969701
Python
Python3
py
Accepted
30
5608
303
dic = {} while(True): try: key, page = input().split() page = int(page) except: break try: dic[key].append(page) except: dic[key] = [page] a = list(dic.keys()) a.sort() for b in a: print(b) print(" ".join(str(e) for e in sorted(dic[b])))
p00105
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
13,659
s929955033
p00106
u899060994
1409320401
Python
Python
py
Accepted
10
4224
369
cost = {15:2244,12:1870,10:1520,5:850,3:550,2:380} mincost = [10000]*51 for j in cost: mincost[j] = cost[j] for i in range(4,51): for j in cost: if mincost[i-j] < 10000 and mincost[i] > mincost[i-j] + cost[j]: mincost[i] = mincost[i-j] + cost[j] while True: n = int(raw_input()) i...
p00106
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
500 2200 0
850 3390
13,660
s288494372
p00106
u912237403
1414663899
Python
Python
py
Accepted
20
4284
434
def f(w1): x=[] a1=w1/500 for i1 in range(a1+1): w2=w1-i1*500 a2=w2/300 for i2 in range(a2+1): w3=w2-i2*300 if w3%200==0: x.append([w3/200,i2,i1]) return x def g(x): m=1e9 A=[380,550,850] B=[.2,.15,.12] C=[5,4,3] for e in x: a=0 for i in [0,1,2]: b=e[i]/C[i]*C[i]...
p00106
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
500 2200 0
850 3390
13,661
s612574774
p00106
u912237403
1414665895
Python
Python
py
Accepted
20
4260
352
def f(w1): m=1e9 for i1 in range(w1/500+1): w2=w1-i1*500 for i2 in range(w2/300+1): w3=w2-i2*300 if w3%200==0: m=min(m,g([w3/200,i2,i1])) return m def g(x): A=[380,550,850] B=[.2,.15,.12] C=[5,4,3] return sum([A[i]*(x[i]-x[i]/C[i]*C[i]*B[i]) for i in [0,1,2]]) while 1: w=input() ...
p00106
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
500 2200 0
850 3390
13,662
s264448200
p00106
u912237403
1414666689
Python
Python
py
Accepted
20
4268
344
def f(w1): m=1e9 for i1 in range(w1/5+1): w2=w1-i1*5 for i2 in range(w2/3+1): w3=w2-i2*3 if w3%2==0: m=min(m,g([w3/2,i2,i1])) return m def g(x): A=[380,550,850] B=[.2,.15,.12] C=[5,4,3] return sum([A[i]*(x[i]-x[i]/C[i]*C[i]*B[i]) for i in [0,1,2]]) while 1: w=input() if w==0: bre...
p00106
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
500 2200 0
850 3390
13,663
s593970668
p00106
u266872031
1428060126
Python
Python
py
Accepted
20
4224
289
P=[99999,99999,380,550,760,850,1100,1230,1400,1610,1520,1950,1870,2070,2250,2244] for i in range(16,51): P.append(min(P[i-2]+380,P[i-3]+550,P[i-5]+850,P[i-10]+1520,P[i-12]+1870,P[i-15]+2244)) while(1): q=int(raw_input()) if q==0: break else: print P[q/100]
p00106
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
500 2200 0
850 3390
13,664
s652324323
p00106
u408260374
1435142064
Python
Python3
py
Accepted
70
6744
383
while True: N = int(input()) if not N: break ans = float('inf') for c200 in range(N//200+1): for c300 in range(N//300+1): for c500 in range(N//500+1): if 200 * c200 + c300 * 300 + c500 * 500 == N: ans = min(ans, 1520*(c200//5)+380*(c200%5)+1870*(c3...
p00106
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
500 2200 0
850 3390
13,665
s149139400
p00106
u775586391
1451544558
Python
Python3
py
Accepted
30
7676
381
while True: n = int(input()) if n == 0: break c = 10000 for i in range(n//500+1): n1 = n - 500*i c1 = (850*3*0.88)*(i//3)+850*(i%3) for j in range(n1//300+1): n2 = n1 - 300*j if n2 % 200 == 0: k = n2 // 200 c2 = c1 + (550*4*0.85)*(j//4)+550*(j%4)+(380*5*0.8)*(k//5)+3...
p00106
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
500 2200 0
850 3390
13,666
s404136920
p00106
u500396695
1478189860
Python
Python3
py
Accepted
80
7668
426
while True: n = int(input()) if n == 0: break cheapest = float('inf') for bagsA in range(n // 200 + 1): for bagsB in range(n // 300 + 1): for bagsC in range(n // 500 + 1): if 200 * bagsA + 300 * bagsB + 500 * bagsC == n: price = 1520 * (bagsA // 5) + 380 * (bagsA % 5) + 1870 * (bagsB // 4) + 550 * (...
p00106
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
500 2200 0
850 3390
13,667
s835604716
p00106
u078042885
1485450422
Python
Python3
py
Accepted
30
7660
283
a=[2,3,5,10,12,15] b=[380,550,850,1520,1870,2244] while 1: n=int(input()) if n==0:break n//=100 dp=[0]+[1<<29]*n for i in range(5,-1,-1): for j in range(n+1): if j+a[i]<=n and dp[j]!=1<<29:dp[j+a[i]]=min(dp[j+a[i]],dp[j]+b[i]) print(dp[n])
p00106
<H1>Discounts of Buckwheat</H1> <p> Aizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves. </p> <p> One day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its unit price for each shop is determined by the follows ...
500 2200 0
850 3390
13,668