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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s520508033 | p00761 | u104911888 | 1368833280 | Python | Python | py | Accepted | 20 | 4240 | 307 | while True:
n,L=raw_input().split()
if n==L=="0":break
S=set()
dic={}
i=0
while n not in dic:
dic[n]=i
n="0"*(int(L)-len(n))+n
a="".join(sorted(n,reverse=True))
b="".join(sorted(n))
n=str(int(a)-int(b))
i+=1
print dic[n],n,i-dic[n] | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,917 |
s465394451 | p00761 | u814249052 | 1370882714 | Python | Python | py | Accepted | 20 | 4296 | 1,071 | def Result(original, digit):
history = [original]
while True:
history.append(next(history[-1], digit))
if history[-1] in history[:-1]:
return history.index(history[-1]), history[-1], len(history) - history.index(history[-1]) - 1
def next(decimal, digit):
tmp = decimal
numbe... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,918 |
s508528190 | p00761 | u553881259 | 1391852794 | Python | Python | py | Accepted | 30 | 4252 | 569 | while True:
a, l = map(int, raw_input().split())
if((a|l) == 0): break
dic = {}
cnt = 0
dic[a] = cnt
while True:
cnt+=1
Sa = str(a)
Sa = [ x for x in list(Sa) if x is not '0']
if len(Sa) is 0: Sa.append('0')
Sa.sort()
S = int("".join(Sa))
L... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,919 |
s389244561 | p00761 | u553881259 | 1391858662 | Python | Python | py | Accepted | 20 | 4228 | 376 | while True:
a, l = map(int, raw_input().split())
if((a|l) == 0): break
dic = {}
cnt = 0
dic[a] = cnt
while True:
cnt+=1
La = list(str(a).zfill(l))
La.sort()
a = int(''.join(La[::-1])) - int(''.join(La))
if a in dic:
print dic[a], a, cnt-dic[a]
... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,920 |
s968150566 | p00761 | u633068244 | 1399535757 | Python | Python | py | Accepted | 20 | 4228 | 290 | while 1:
a,L = raw_input().split()
if a == L == "0": break
a = a.zfill(int(L))
his = [0]*21
his[0] = a
i = 0
while 1:
i += 1
a = str(int("".join(sorted(a)[::-1])) - int("".join(sorted(a)))).zfill(int(L))
if a in his: break
his[i] = a
print his.index(a),int(a),i-his.index(a) | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,921 |
s760030893 | p00761 | u759949288 | 1402375497 | Python | Python | py | Accepted | 20 | 4240 | 511 | import sys
readline = sys.stdin.readline
while True:
A, L = (int(x) for x in readline().split())
if A == 0 and L == 0: break
cnt = 0
past = {A: 0}
while True:
A = list(str(A).rjust(int(L), '0'))
A.sort()
minA = int("".join(A))
maxA = int("".join(reversed(A)))
... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,922 |
s528504235 | p00761 | u146816547 | 1578122058 | Python | Python3 | py | Accepted | 30 | 5600 | 422 | #!/usr/bin/env python3
while True:
a, l = map(int, input().split())
if a == 0 and l == 0: break
d, i = {}, 0
while True:
if d.get(a) != None:
print(d[a], a, i-d[a])
break
d[a] = i; i += 1
s = str(a)
s = "0"*(l-len(s)) + s
big = int( "".j... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,923 |
s321797520 | p00761 | u926637872 | 1567497324 | Python | Python3 | py | Accepted | 40 | 5600 | 686 | while True:
line = input().split(" ")
a0 = int(line[0])
L = int(line[1])
if a0 == 0 and L == 0:
break
#print(a0)
a_list = [a0]
a0 = str(a0).zfill(L)
sortedA = sorted(a0)
minNum = int("".join(sortedA))
sortedB = sorted(a0, reverse=True)
maxNum = int("".join(sortedB))... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,924 |
s608505622 | p00761 | u215870135 | 1562848651 | Python | Python3 | py | Accepted | 30 | 5632 | 738 | import sys
input = sys.stdin.readline
def main():
while True:
a, l = input().strip().split()
l = int(l)
if l == 0:
break
a = a.zfill(l)
check = [int(a)]
j = 1
ok = False
while True:
tmp = "".join(sorted(list(a)))
# ... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,925 |
s105619507 | p00761 | u464321546 | 1562136219 | Python | Python3 | py | Accepted | 30 | 5600 | 599 | def Numseque(a, l):
a = list(str(a))
while len(a) < l:
a.insert(0,"0")
a.sort()
a0 = a
a0 = "".join(a0)
a.sort(reverse=True)
a1 = a
return int("".join(a1))-int(a0)
def main(a0, l):
a = [a0]
while 1:
a.append(Numseque(a[-1], l))
if a[-1] in a[:len(a) - 1]:... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,926 |
s531391101 | p00761 | u931913851 | 1561686228 | Python | Python3 | py | Accepted | 40 | 5616 | 931 | "繰り返す10真数"
def new_a(n, L):
numbers = [int(x) for x in list(str(n))]
if len(numbers) != L:
numbers.extend([0]*(L-len(numbers)))
numbers.sort(reverse=True)
max_n = 0
for i, n in enumerate(numbers):
max_n += n
if i != (len(numbers)-1):
max_n *= 10
numbers.so... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,927 |
s804097421 | p00761 | u317942270 | 1561482329 | Python | Python3 | py | Accepted | 40 | 5624 | 956 | ans_list = []
def solve():
a, L = map(int,input().split())
if (a, L) == (0,0):
return "end"
def Add(n: int) -> list:
n = str(n)
n = list(n)
n = [int(s) for s in n]
n = [0]*(L - len(n)) + n
return n
def Max(n: list) -> int:
n = sorted(n, reverse=... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,928 |
s416608447 | p00761 | u200148444 | 1561372534 | Python | Python3 | py | Accepted | 40 | 5600 | 586 | def dfs(b):
s=str(b)
for i in range(l-len(s)):
s="0"+s
l0=[]
for z in range(l):
l0.append(s[z])
l1=[]
l1=sorted(l0)
s1=str()
s2=str()
for x in l1:
s1=s1+x
s2=x+s2
i1=int(s1)
i2=int(s2)
return i2-i1
while True:
a,l=map(int,input().split(... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,929 |
s498671623 | p00761 | u598814210 | 1561004841 | Python | Python3 | py | Accepted | 30 | 5612 | 604 | while True:
a0, L = map(int, input().split())
if a0==0 and L==0:
break
s = ("{:0" + str(L) + "d}").format(a0)
hist = [a0]
for i in range(1, 21):
# print(hist)
large = "".join(sorted(s, reverse=True))
small = "".join(sorted(s))
# print(large)
# print(s... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,930 |
s929598670 | p00761 | u150984829 | 1558157593 | Python | Python3 | py | Accepted | 30 | 5596 | 396 | for e in iter(input, '0 0'):
a, l = map(int, e.split())
his = [a]
for i in range(1, 30):
a = str(a)
size = len(a)
res = sorted(a + '0' * (l - size))
mi = int(''.join(res))
ma = int(''.join(res)[::-1])
a = ma - mi
if a in his:
break
... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,931 |
s853674131 | p00761 | u701749469 | 1556785638 | Python | Python3 | py | Accepted | 40 | 5608 | 1,444 | def main():
while True:
line = input().split()
num = line[0]
digit = int(line[1])
if digit == 0: break
if num == '0':
print("0 0 1")
continue
num = addzero(num, digit)
numlist = [num]
for i in range(20):
nextt = n... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,932 |
s408761803 | p00761 | u990228206 | 1554362776 | Python | Python3 | py | Accepted | 30 | 5604 | 360 | while 1:
n,m=map(int,input().split())
if n==m==0:break
ai=0
nl=[n]
while 1:
ai+=1
ni=int("".join(map(str,sorted(str(n).zfill(m))[::-1])))-int("".join(map(str,sorted(str(n).zfill(m)))))
if ni in nl:
break
else:
n=ni
nl.append(ni)
... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,933 |
s191808730 | p00761 | u352394527 | 1547465561 | Python | Python3 | py | Accepted | 30 | 5596 | 454 | while True:
a, length = map(int, input().split())
if length == 0:
break
mem = dict()
mem[a] = 0
cnt = 0
while True:
cnt += 1
sa = list(str(a).zfill(length))
sa.sort()
under = int("".join(sa))
sa.reverse()
top = int("".join(sa))
a = ... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,934 |
s364786236 | p00761 | u158979022 | 1544438404 | Python | Python3 | py | Accepted | 30 | 5600 | 275 | while True:
n, d = input().split()
if n == '0' and d == '0':
break
a = [int(n)]
while True:
n = ''.join(sorted(n.zfill(int(d))))
b = int(n[::-1]) - int(n)
if b in a:
break
a += [b]
n = str(b)
print(a.index(b), b, len(a) - a.index(b))
| p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,935 |
s782533239 | p00761 | u281836941 | 1531729953 | Python | Python3 | py | Accepted | 30 | 5600 | 393 | # coding: utf-8
while 1:
a,b=input().split()
b=int(b)
if b==0:
break
a='0'*(b-len(a))+a
dic={}
i=0
while 1:
if a in dic:
print(dic[a],int(a),i-dic[a])
break
else:
dic[a]=i
a=str(int(''.join(sorted(list(a),reverse=True)))-int... | p00761 |
<h1>Recurring Decimals</h1>
<!-- end en only -->
<!-- begin en only -->
<p>
A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.
Let us make a sequence using this fact.
</p>
<p>
A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ... | 2012 4
83268 6
1112 4
0 1
99 2
0 0
| 3 6174 1
1 862632 7
5 6174 1
0 0 1
1 0 1
| 24,936 |
s826599133 | p00767 | u328199937 | 1555911766 | Python | Python3 | py | Accepted | 60 | 5684 | 539 | import math
anslist = []
while True:
h, w = map(int, input().split())
if h == 0 and w == 0:
break
diagonal = h * h + w * w
i = h + 1
#print(diagonal)
while True:
#print(i, diagonal - i * i, diagonal)
if i * i >= diagonal - i * i:
i = 0
diagonal +... | p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,937 |
s024592734 | p00767 | u408260374 | 1421923620 | Python | Python3 | py | Accepted | 70 | 8028 | 242 | rect = [(i**2+j**2, i, j) for i in range(1,150) for j in range(i+1, 150)]
rect.sort()
while True:
h, w = map(int, input().split())
if h == 0 and w == 0: break
_, n_h, n_w = rect[rect.index((h**2+w**2, h, w))+1]
print(n_h, n_w) | p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,938 |
s425656680 | p00767 | u966364923 | 1443966415 | Python | Python3 | py | Accepted | 80 | 8660 | 250 | import itertools
S=[]
for i in range(1,150):
for j in range(1,i):
S.append((i*i+j*j,j,i))
S.sort()
while True:
h,w=map(int, input().split())
if h==0 and w==0:
exit()
s = S[S.index((w*w+h*h,h,w))+1]
print(s[1],s[2]) | p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,939 |
s511734783 | p00767 | u797673668 | 1454141985 | Python | Python3 | py | Accepted | 60 | 8692 | 358 | from bisect import bisect_right
rectangles = [(h ** 2 + w ** 2, h, w) for h in range(1, 151) for w in range(1, 151) if h < w]
rectangles.sort()
while True:
h, w = map(int, input().split())
if not h and not w:
break
gt_rectangle = rectangles[bisect_right(rectangles, (h ** 2 + w ** 2, h, w))]
p... | p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,940 |
s547297270 | p00767 | u660912567 | 1484308450 | Python | Python3 | py | Accepted | 80 | 9060 | 228 | l = [[i**2+j**2,i,j] for j in range(1,151) for i in range(1,151) if i!=j and i<j]
l = sorted(l)
while True:
h,w = map(int,input().split())
if w==h==0: break
i = l.index([w**2+h**2,h,w])+1
print(*l[i][1:],sep=' ') | p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,941 |
s770550345 | p00767 | u660912567 | 1484308900 | Python | Python3 | py | Accepted | 60 | 8964 | 244 | import bisect
l = [[i**2+j**2,i,j] for j in range(1,151) for i in range(1,151) if i!=j and i<j]
l.sort()
while True:
h,w = map(int,input().split())
if w==h==0: break
r = l[bisect.bisect_right(l,[w**2+h**2,h,w])]
print(r[1],r[2]) | p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,942 |
s472852553 | p00767 | u660912567 | 1487548745 | Python | Python3 | py | Accepted | 60 | 9140 | 248 | import bisect
l = sorted([[i**2+j**2,i,j] for j in range(1,150) for i in range(1,150) if i<j and i!=j])
while True:
h,w = map(int,input().split())
if h==w==0: break
rh,rw = l[bisect.bisect_right(l, [h**2+w**2,h,w])][1:]
print(rh,rw) | p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,943 |
s301641580 | p00767 | u260980560 | 1499853945 | Python | Python | py | Accepted | 40 | 8384 | 179 | A=[(j,i)for i in range(150)for j in range(1,i)]
A.sort(key=lambda(j,i):(i**2+j**2,j,i))
while 1:
h,w=map(int,raw_input().split())
if h<1:break
h,w=A[A.index((h,w))+1];print h,w | p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,944 |
s025156739 | p00767 | u023471147 | 1527059726 | Python | Python3 | py | Accepted | 50 | 5712 | 438 | from math import ceil
while True:
h, w = map(int, input().split())
if h == w == 0:
break
ha, wa = 150, 150
dia = h**2 + w**2
for hi in range(1, 150):
wi = ceil((dia - hi ** 2) ** (1 / 2))
if hi >= wi:
break
if dia == hi**2 + wi**2:
if hi <=... | p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,945 |
s275405515 | p00767 | u509278866 | 1527915510 | Python | Python3 | py | Accepted | 100 | 10840 | 977 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF()... | p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,946 |
s905114864 | p00767 | u104911888 | 1375069720 | Python | Python | py | Accepted | 80 | 5476 | 313 | L=[]
for h in range(1,150):
for w in range(h+1,151):
L.append((h*h+w*w,h,w))
L.sort()
while True:
h,w=map(int,raw_input().split())
if h==w==0:break
d=h*h+w*w
for dd,dh,dw in L:
if dd==d and dh>h:
print dh,dw
break
elif dd>d:
print dh,dw
break | p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,947 |
s010008897 | p00767 | u633068244 | 1399894614 | Python | Python | py | Accepted | 30 | 5784 | 226 | S = []
for i in range(1,100):
for j in range(i+1,151):
S.append([i,j])
S = sorted(S, key = lambda x:x[0]**2 + x[1]**2)
while 1:
h,w = map(int,raw_input().split())
if h == 0: break
hi,wi = S[S.index([h,w])+1]
print hi,wi | p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,948 |
s924787013 | p00767 | u633068244 | 1399895126 | Python | Python | py | Accepted | 30 | 5772 | 202 | S = sorted([[i,j] for i in range(1,100) for j in range(i+1,151)], key = lambda x:x[0]**2+x[1]**2)
while 1:
h,w = map(int,raw_input().split())
if h == 0: break
hi,wi = S[S.index([h,w])+1]
print hi,wi | p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,949 |
s084195907 | p00767 | u829695570 | 1578648428 | Python | Python3 | py | Accepted | 80 | 8108 | 273 | a = []
for w in range(2, 201):
for h in range(1, w):
a.append([h**2+w**2, h, w])
a.sort()
while 1:
h,w = map(int,input().split())
if h == 0: break
# print(a.index([h**2+w**2,h,w]))
ans = a[a.index([h**2+w**2,h,w])+1]
print(ans[1], ans[2])
| p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,950 |
s746543011 | p00767 | u537067968 | 1562467060 | Python | Python3 | py | Accepted | 50 | 6724 | 230 | poly = []
for w in range(2,150):
for h in range(1,w):
poly.append((w*w+h*h,h,w))
poly.sort()
while True:
h,w = map(int,input().split())
if h + w == 0:
break
a = poly.index((w*w+h*h,h,w))
print(poly[a+1][1],poly[a+1][2])
| p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,951 |
s303738454 | p00767 | u744506422 | 1559895190 | Python | Python3 | py | Accepted | 80 | 8956 | 424 | X=[]
while(True):
h,w=map(int,input().split())
if (h,w)==(0,0):
break
else:
X.append((h,w))
Y=[]
N=200
for h in range(1,N+1):
for w in range(h+1,N+1):
Y.append((h*h+w*w,min(h,w),h,w))
Y.sort()
Z=[[-1 for i in range(N+1)] for j in range(N+1)]
for i in range(len(Y)):
p,q,r,s=Y[... | p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,952 |
s040375836 | p00767 | u990228206 | 1554354514 | Python | Python3 | py | Accepted | 60 | 5664 | 336 | while 1:
h,w=map(int,input().split())
if h==w==0:break
r=h**2+w**2
d_m=float("inf")
ax,ay=0,0
for x in range(1,int(r**0.5)+2):
y=int([(r-x**2),0][(r-x**2)<0]**0.5)
y+=[1,0][r==x**2+y**2 and h<x]
if x>=y:continue
dia=x**2+y**2
if d_m>dia:d_m,ax,ay=dia,x,y
... | p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,953 |
s644615669 | p00767 | u352394527 | 1547460279 | Python | Python3 | py | Accepted | 70 | 6748 | 263 | lst = []
for h in range(1, 151):
for w in range(h + 1, 151):
lst.append((h ** 2 + w ** 2, h, w))
lst.sort()
while True:
h, w = map(int, input().split())
if h == 0:break
ind = lst.index((h ** 2 + w ** 2, h, w))
print(*lst[ind + 1][1:])
| p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,954 |
s589810145 | p00767 | u150984829 | 1540005730 | Python | Python3 | py | Accepted | 40 | 8388 | 291 | t = [(i * i + j * j, (i, j)) for i in range(1, 151) for j in range(i + 1, 151)]
t.sort()
d = {a[1]: b[1] for a, b in zip(t, t[1:])}
res = []
for e in iter(input, '0 0'):
h, w = map(int, e.split())
ans = d[h, w]
res.append(' '.join(map(str, ans)))
print('\n'.join(map(str, res)))
| p00767 |
<h3>Integral Rectangles</h3>
<p>
Let us consider rectangles whose height, <i>h</i>, and
width, <i>w</i>, are both integers. We call such rectangles <em>
integral rectangles</em>. In this problem, we consider only wide
integral rectangles, i.e., those with <i>w</i> > <i>h</i>.
</p>
<p>
We define the following orde... | 1 2
1 3
2 3
1 4
2 4
5 6
1 8
4 7
98 100
99 100
0 0
| 1 3
2 3
1 4
2 4
3 4
1 8
4 7
2 8
3 140
89 109
| 24,955 |
s807148471 | p00768 | u617183767 | 1421852465 | Python | Python | py | Accepted | 60 | 4756 | 1,365 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import itertools
import math
from collections import Counter, defaultdict
class Main(object):
def __init__(self):
pass
def solve(self):
'''
insert your code
'''
while True:
M, T, P, R ... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,956 |
s184963022 | p00768 | u731235119 | 1422034429 | Python | Python | py | Accepted | 60 | 4332 | 892 | def islower (t_a,t_b):
if t_a[1] != t_b[1]:
return t_a[1] < t_b[1]
elif t_a[2] != t_b[2]:
return t_a[2] > t_b[2]
else :
return t_a[0] < t_b[0]
import sys
while 1:
M, T, P, R = map(int,raw_input().split())
if (T,P,R) == (0,0,0):
break
score = [[i,0,0] for i in xrange(1,T+1)]
wrong = [[0 for i in xrange(P... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,957 |
s329787501 | p00768 | u260980560 | 1499854825 | Python | Python | py | Accepted | 80 | 6460 | 634 | while 1:
M, T, P, R = map(int, raw_input().split())
if M+T+P+R==0:
break
score = [0]*T; cnt = [0]*T; failed = {}
for i in xrange(R):
m, t, p, j = map(int, raw_input().split())
if j == 0:
score[t-1] += m + failed.get((t, p), 0)
cnt[t-1] += 1
else:
... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,958 |
s369428803 | p00768 | u811733736 | 1505650088 | Python | Python3 | py | Accepted | 80 | 7968 | 2,712 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1187&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
class Team(object):
def __init__(self, id):
self.id = id
self.correct = 0 # ??£?§£??°
self.time = 0 # ??????????... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,959 |
s136405127 | p00768 | u811733736 | 1505655064 | Python | Python3 | py | Accepted | 100 | 8128 | 2,787 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1187&lang=jp
AC
"""
import sys
from sys import stdin
input = stdin.readline
class Team(object):
def __init__(self, id):
self.id = id
self.correct = 0 # ??£?§£??°
self.time = 0 # ????????... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,960 |
s041710820 | p00768 | u072053884 | 1511075553 | Python | Python3 | py | Accepted | 80 | 7836 | 850 | import sys
file_input = sys.stdin
for line in file_input:
M, T, P, R = map(int, line.split())
if M == 0:
break
# [number of solved probrems, complement of elapsed time, team number] + [rejected times] * P
# [rejected times] * P will be accessed in reverse order.
result = [[0, M, i] + ... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,961 |
s118898360 | p00768 | u724548524 | 1525533702 | Python | Python3 | py | Accepted | 100 | 5628 | 851 | def juni(tp):
s = str(tp[0][0])
for i in range(1, len(tp)):
if tp[i - 1][1] == tp[i][1] and tp[i - 1][2] == tp[i][2]:
s += "=" + str(tp[i][0])
else:
s += "," + str(tp[i][0])
return s
while True:
m, t, p, r = map(int, input().split())
if m == 0:
break
... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,962 |
s835280179 | p00768 | u023471147 | 1527132051 | Python | Python3 | py | Accepted | 100 | 5640 | 909 | while True:
m, t, p, r = map(int, input().split())
if m == t == p == r == 0:
break
score = [[-1 for i in range(p + 1)] for j in range(t + 1)]
for i in range(r):
mi, ti, pi, j = map(int, input().split())
if not j:
score[ti][pi] = mi - (score[ti][pi] + 1) * 20
... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,963 |
s935174543 | p00768 | u104911888 | 1375074431 | Python | Python | py | Accepted | 50 | 4452 | 897 | while True:
M,T,P,R=map(int,raw_input().split())
if M==T==P==R==0:break
PB=[[False]*P for i in range(T+1)]
PN=[[0]*P for i in range(T+1)]
TM=[M]*(T+1)
for i in range(R):
m,t,p,r=map(int,raw_input().split())
if r==0:
PB[t][p-1]=True
TM[t]+=m
else:
... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,964 |
s067775122 | p00768 | u633068244 | 1399897315 | Python | Python | py | Accepted | 60 | 4332 | 602 | while 1:
M,T,P,R = map(int,raw_input().split())
if M == 0: break
S = [[-1]*P for i in range(T)]
PN = [[0]*P for i in range(T)]
for i in range(R):
m,t,p,j = map(int,raw_input().split())
if j == 0:
S[t-1][p-1] = m + PN[t-1][p-1]
else:
PN[t-1][p-1] += 20
A = [[t+1,P-S[t].count(-1),sum(S[t])] for t in ran... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,965 |
s799594301 | p00768 | u633068244 | 1399897433 | Python | Python | py | Accepted | 50 | 4332 | 561 | while 1:
M,T,P,R = map(int,raw_input().split())
if M == 0: break
S = [[-1]*P for i in range(T)]
PN = [[0]*P for i in range(T)]
for i in range(R):
m,t,p,j = map(int,raw_input().split())
if j == 0:
S[t-1][p-1] = m + PN[t-1][p-1]
else:
PN[t-1][p-1] += 20
A = [[t+1,P-S[t].count(-1),sum(S[t])] for t in ran... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,966 |
s239329389 | p00768 | u215870135 | 1562689181 | Python | Python3 | py | Accepted | 90 | 6456 | 1,518 | import sys
input = sys.stdin.readline
def main():
while True:
M, T, P, R = map(int, input().split())
if M == 0:
break
results = [[i,0,0] for i in range(T)]
if R > 0:
logs = [list(map(int, input().split())) for i in range(R)]
logs = sorted(logs, ke... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,967 |
s023019746 | p00768 | u464321546 | 1562137779 | Python | Python3 | py | Accepted | 100 | 5628 | 827 | def main(M, T, P, R):
team = [[0, 0, i + 1] for i in range(T)]
teamprob = [[0] * P for i in range(T)]
for _ in range(R):
m, t, p, r = map(int, input().split())
if r == 0:
team[t - 1][0] += 1
team[t - 1][1] -= m
team[t - 1][1] -= teamprob[t - 1][p - 1]
... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,968 |
s564741507 | p00768 | u489876484 | 1562128854 | Python | Python3 | py | Accepted | 90 | 5632 | 968 | import sys
def main():
while True:
M,T,P,R = map(int,input().split())
if not M and not T and not P and not R:
return
prob = [[0]*(P+1) for _ in range(T+1)]
result = dict([(t,[0,sys.maxsize]) for t in range(1,T+1)]) # (t,m,p)
for _ in range(R):
m,t,p,j... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,969 |
s490869438 | p00768 | u744506422 | 1559896677 | Python | Python3 | py | Accepted | 100 | 5636 | 829 | import sys
while(True):
M,T,P,R=map(int,input().split())
if (M,T,P,R)==(0,0,0,0):
break
points=[0 for i in range(T)]
time=[0 for i in range(T)]
penalty=[[0 for i in range(T)] for i in range(P)]
for i in range(R):
m,t,p,j=map(int,input().split())
#正解したものをもう一度出すかどうかは考慮しない
... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,970 |
s170974462 | p00768 | u150984829 | 1540009935 | Python | Python3 | py | Accepted | 70 | 5664 | 669 | import sys
input = sys.stdin.readline
for e in iter(input, '0 0 0 0\n'):
M, T, P, R = map(int, e.split())
result = [[0, M, i] + [0] * P for i in range(T + 1)]
for _ in range(R):
m, t, p, j = map(int, input().split())
team_data = result[t]
if j:
team_data[-p] += 1
... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,971 |
s290075592 | p00768 | u281836941 | 1531801994 | Python | Python3 | py | Accepted | 100 | 5740 | 691 | # coding: utf-8
while 1:
m,t,p,r=map(int,input().split())
if m==0:
break
teamdata=[[0,0,i+1,set()] for i in range(t)]
data=[]
for i in range(r):
a,b,c,d=map(int,input().split())
if d==0:
teamdata[b-1][0]+=1
teamdata[b-1][1]+=a
teamdata[b-1]... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,972 |
s149798751 | p00768 | u454636644 | 1498121886 | Python | Python3 | py | Accepted | 100 | 7832 | 851 | while True:
M, T, P, R = map(int, input().split())
if M == T == P == R == 0:
quit()
a_list = [[0, 0, i] for i in range(T)]
wa = [[0 for j in range(P)] for i in range(T)]
for i in range(R):
m, t, p, j = map(int, input().split())
t -= 1
p -= 1
if j == 0:
... | p00768 |
<h3>ICPC Ranking</h3>
<p>
Your mission in this problem is to write a program
which, given the submission log of an ICPC (International Collegiate Programming Contest),
determines team rankings.
</p>
<p>
The log is a sequence of records of program submission
in the order of submission.
A record has four fields: elaps... | 300 10 8 5
50 5 2 1
70 5 2 0
75 1 1 0
100 3 1 0
150 3 2 0
240 5 5 7
50 1 1 0
60 2 2 0
70 2 3 0
90 1 3 0
120 3 5 0
140 4 1 0
150 2 4 1
180 3 5 4
15 2 2 1
20 2 2 1
25 2 2 0
60 1 1 0
120 5 5 4
15 5 4 1
20 5 4 0
40 1 1 0
40 2 2 0
120 2 3 4
30 1 1 0
40 2 1 0
50 2 2 0
60 1 2 0
120 3 3 2
0 1 1 0
1 2 2 0
300 5 8 0
0 0 0 0
| 3,1,5,10=9=8=7=6=4=2
2,1,3,4,5
1,2,3
5=2=1,4=3
2=1
1,2,3
5=4=3=2=1
| 24,973 |
s546946182 | p00769 | u281836941 | 1514628453 | Python | Python3 | py | Accepted | 90 | 5700 | 1,146 | def AC():
def solve(s):
if s.count('[')==1:
return int(s[1:-1])
elif '][' in s and ']][[' not in s:
tmp = sorted(map(int,s[2:-2].split('][')))
ans=0
for i in range(len(tmp)//2+1):
ans+=tmp[i]//2+1
return ans
else:
... | p00769 |
<h3>Hierarchical Democracy</h3>
<p>
The presidential election in Republic of Democratia is carried out through multiple stages as follows.
</p>
<ol>
<li>There are exactly two presidential candidates.</li>
<li>At the first stage, eligible voters go to the polls of his/her electoral district.
The winner of the dist... | 6
[[123][4567][89]]
[[5][3][7][3][9]]
[[[99][59][63][85][51]][[1539][7995][467]][[51][57][79][99][3][91][59]]]
[[[37][95][31][77][15]][[43][5][5][5][85]][[71][3][51][89][29]][[57][95][5][69][31]][[99][59][65][73][31]]]
[[[[9][7][3]][[3][5][7]][[7][9][5]]][[[9][9][3]][[5][9][9]][[7][7][3]]][[[5][9][7]][[3][9][3]][[9][5]... | 107
7
175
95
21
3599
| 24,974 |
s428355579 | p00775 | u609255173 | 1409153801 | Python | Python | py | Accepted | 20 | 4400 | 443 | import math
while True:
(r, n) = map(int, raw_input().split())
if r + n == 0: break
hs = {}
for i in range(-22, 22 + 1):
hs[i] = 0
for _ in range(n):
(xl, xr, h) = map(int, raw_input().split())
for i in range(xl, xr):
hs[i] = max(hs[i], h)
ans = 10 ** 9
for i in range(-r, r):
p =... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,975 |
s637145040 | p00775 | u633068244 | 1424623524 | Python | Python | py | Accepted | 100 | 4308 | 526 | while 1:
r,n = map(int,raw_input().split())
if r == 0: break
h = {i:0 for i in xrange(-21,21)}
for loop in xrange(n):
xl,xr,hi = map(int,raw_input().split())
for i in xrange(xl,xr):
h[i] = max(h[i],hi)
for i in xrange(20,-21,-1):
h[i] = min(h[i-1],h[i])
y,d... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,976 |
s952727648 | p00775 | u260980560 | 1482841700 | Python | Python | py | Accepted | 40 | 6416 | 433 | from math import sqrt
def calc(x, h):
return max(h+r-sqrt(r**2 - x**2), 0)
while 1:
r, n = map(int, raw_input().split())
if r == 0:
break
H = [0]*41
for i in xrange(n):
xl, xr, h = map(int, raw_input().split())
for j in xrange(xl, xr):
H[j] = max(H[j], h)
ans ... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,977 |
s776162108 | p00775 | u999854911 | 1489993162 | Python | Python3 | py | Accepted | 50 | 7740 | 917 | import sys
import math
OFFSET = 20
def main():
while True:
r,n = map(int, sys.stdin.readline().split())
if r == 0 and n == 0:
break
seq = [0] * 40
for i in range(n):
x1,x2,h = map(int,sys.stdin.readline().split())
for k in range(x1, x2):
... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,978 |
s231456334 | p00775 | u408260374 | 1495185391 | Python | Python3 | py | Accepted | 60 | 7640 | 590 | while True:
R, N = map(int, input().split())
if not (R | N):
break
geta = 20
buildings = [0] * (geta * 2)
for _ in range(N):
xl, xr, h = map(int, input().split())
for i in range(xl + geta, xr + geta):
buildings[i] = max(buildings[i], h)
ans = 20
for i in ... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,979 |
s556765188 | p00775 | u408260374 | 1495185567 | Python | Python3 | py | Accepted | 60 | 7772 | 412 | while True:
R, N = map(int, input().split())
if not (R | N):
break
geta = 20
buildings = [0] * (geta * 2)
for _ in range(N):
xl, xr, h = map(int, input().split())
for i in range(xl + geta, xr + geta):
buildings[i] = max(buildings[i], h)
print(min(buildings[i]... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,980 |
s513427337 | p00775 | u408260374 | 1495185669 | Python | Python3 | py | Accepted | 50 | 7668 | 450 | from math import sqrt
while True:
R, N = map(int, input().split())
if not (R | N):
break
geta = 20
buildings = [0] * (geta * 2)
for _ in range(N):
xl, xr, h = map(int, input().split())
for i in range(xl + geta, xr + geta):
buildings[i] = max(buildings[i], h)
... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,981 |
s509862895 | p00775 | u283315132 | 1499876080 | Python | Python3 | py | Accepted | 60 | 7828 | 580 | import math
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
r, n = rli()
while(r != 0):
shade = [0 for i in range(41)]
shade[40] = 1145148101919
t = [1145148101919 for i in range(41)]
for i in range(n):
xl, xr, h = rli()
for j in range(xl+20, xr+20):
... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,982 |
s230759894 | p00775 | u467175809 | 1529072150 | Python | Python | py | Accepted | 30 | 4776 | 566 | #!/usr/bin/env python
from math import *
while True:
r, n = map(int, raw_input().split())
if r == 0:
break
m = {}
for i in range(-50, 50):
m[i] = 0
for loop in range(n):
x1, x2, h = map(int, raw_input().split())
for i in range(x1, x2):
m[i] = max(m[i], ... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,983 |
s516483983 | p00775 | u509278866 | 1529645396 | Python | Python3 | py | Accepted | 70 | 9084 | 1,305 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]
def LI(): return [int(x) for x in sys.stdi... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,984 |
s748331850 | p00775 | u855199458 | 1530027602 | Python | Python3 | py | Accepted | 50 | 5696 | 640 | # -*- coding: utf-8 -*-
from math import sqrt
def inpl(): return list(map(int, input().split()))
R, N = inpl()
while R:
H = [0] * 41
r0 = 0
l0 = 0
for _ in range(N):
l, r, h = inpl()
if l < 0 and r >= 0:
l0 = max(l0, h)
if l <= 0 and r > 0:
r0 = max(r0, h)... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,985 |
s462081019 | p00775 | u328199937 | 1562810168 | Python | Python3 | py | Accepted | 60 | 5700 | 940 | import math
while True:
r, n = map(int, input().split())
if r == 0 and n == 0:
break
sun_place = [-10000000000000000000 for _ in range(r)]
for i in range(r):
sun_place[i] = 0 - r + math.sqrt(r * r - i * i)
ans = 10000000000000000
bilding1 = [0 for i in range(len(sun_place))]
... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,986 |
s504049154 | p00775 | u886122084 | 1561106802 | Python | Python3 | py | Accepted | 40 | 6072 | 839 | from collections import defaultdict
# -*- coding: utf-8 -*-
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
def main():
rr = []
while True:
r, n = map(int, input().split())
if r == 0 and n == 0:
break
a = [list(map(int, in... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,987 |
s522854570 | p00775 | u464321546 | 1561039973 | Python | Python3 | py | Accepted | 60 | 8272 | 3,128 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): ret... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,988 |
s050901605 | p00775 | u245823788 | 1560004058 | Python | Python3 | py | Accepted | 60 | 5680 | 411 | while True:
r, n = list(map(int, input().split()))
if r==0:
break
b = [0 for i in range(60)]
for i in range(n):
ll, rr, x = list(map(int, input().split()))
for j in range(ll, rr):
b[30+j] = max(b[30+j], x)
b[30-r-1], b[30+r] = 1e9, 1e9
ans = 1e9
for x in range(30-r, 30+r+1):
t = (r... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,989 |
s377303341 | p00775 | u281836941 | 1514877933 | Python | Python3 | py | Accepted | 80 | 5680 | 582 | while 1:
co=[0 for i in range(40)]
r,n=map(int,input().split())
if r==n==0:
break
for i in range(n):
a,b,h=map(int,input().split())
a+=20
b+=20
for j in range(a,b):
co[j]=max(co[j],h)
r_list=[]
for i in range(r):
r_list.append((r**2-i**... | p00775 |
<h3>Vampire</h3>
<p>
Mr. C is a vampire. If he is exposed to the sunlight directly, he turns
into ash.
Nevertheless, last night, he attended to the meeting of Immortal and
Corpse Programmers
Circle, and he has to go home in the near dawn.
Fortunately, there are many tall buildings around Mr. C's home, and
while th... | 2 3
-2 -1 3
0 1 3
2 3 3
2 2
-2 0 4
0 2 3
2 6
-3 3 1
-2 3 2
-1 3 3
0 3 4
1 3 5
2 3 6
2 6
-3 3 1
-3 2 2
-3 1 3
-3 0 4
-3 -1 5
-3 -2 6
0 0
| 0.0000
3.0000
2.2679
2.2679
| 24,990 |
s572754033 | p00780 | u847467233 | 1531992669 | Python | Python3 | py | Accepted | 60 | 5720 | 527 | # AOJ 1200: Goldbach's Conjecture
# Python3 2018.7.19 bal4u
MAX = 32770 # > 2^15
SQRT = 182 # sqrt(MAX)+1
prime = [True]*(MAX+1)
def sieve():
for i in range(4, MAX, 2): prime[i] = False
for i in range(3, SQRT, 2):
if prime[i]:
for j in range(i*i, MAX, i): prime[j] = False
sieve()
w... | p00780 |
<H1><font color="#000">Problem A:</font>Goldbach's Conjecture</H1>
<p>
<b>Goldbach's Conjecture:</b> For any even number <i>n</i> greater than or equal to 4, there exists at least one pair of prime numbers <i>p</i><sub>1</sub> and <i>p</i><sub>2</sub> such that <i>n</i> = <i>p</i><sub>1</sub> + <i>p</i><sub>2</sub>.
... | 6
10
12
0
| 1
2
1
| 24,991 |
s852176721 | p00780 | u546285759 | 1493179766 | Python | Python3 | py | Accepted | 50 | 7884 | 435 | import bisect
primes = [0, 0] + [1]*32767
for i in range(2, 182):
if primes[i]:
for j in range(i*i, 32769, i):
primes[j] = 0
prime_value = [i for i in range(2, 32769) if primes[i]]
while True:
n = int(input())
if n == 0:
break
x = bisect.bisect_left(prime_value, n//2)
y ... | p00780 |
<H1><font color="#000">Problem A:</font>Goldbach's Conjecture</H1>
<p>
<b>Goldbach's Conjecture:</b> For any even number <i>n</i> greater than or equal to 4, there exists at least one pair of prime numbers <i>p</i><sub>1</sub> and <i>p</i><sub>2</sub> such that <i>n</i> = <i>p</i><sub>1</sub> + <i>p</i><sub>2</sub>.
... | 6
10
12
0
| 1
2
1
| 24,992 |
s921703358 | p00780 | u546285759 | 1516531785 | Python | Python3 | py | Accepted | 50 | 6044 | 370 | import bisect
primes = [0, 0] + [1] * 32767
for i in range(2, 182):
if primes[i]:
for j in range(i*i, 32769, i):
primes[j] = 0
prime_values = [i for i, v in enumerate(primes) if v]
while True:
n = int(input())
if n == 0:
break
eov = bisect.bisect(prime_values, n//2)
prin... | p00780 |
<H1><font color="#000">Problem A:</font>Goldbach's Conjecture</H1>
<p>
<b>Goldbach's Conjecture:</b> For any even number <i>n</i> greater than or equal to 4, there exists at least one pair of prime numbers <i>p</i><sub>1</sub> and <i>p</i><sub>2</sub> such that <i>n</i> = <i>p</i><sub>1</sub> + <i>p</i><sub>2</sub>.
... | 6
10
12
0
| 1
2
1
| 24,993 |
s771239094 | p00780 | u260980560 | 1385643813 | Python | Python | py | Accepted | 50 | 4472 | 315 | M = 2**15+1
isPrime = [True]*M
isPrime[0],isPrime[1]=False,False
for i in xrange(M):
if isPrime[i]:
for j in xrange(i*i,M,i):
isPrime[j] = False
while 1:
n = input()
if n==0: break
ans = 0
for i in xrange(2,n/2+1):
if isPrime[i] and isPrime[n-i]: ans+=1
print ans | p00780 |
<H1><font color="#000">Problem A:</font>Goldbach's Conjecture</H1>
<p>
<b>Goldbach's Conjecture:</b> For any even number <i>n</i> greater than or equal to 4, there exists at least one pair of prime numbers <i>p</i><sub>1</sub> and <i>p</i><sub>2</sub> such that <i>n</i> = <i>p</i><sub>1</sub> + <i>p</i><sub>2</sub>.
... | 6
10
12
0
| 1
2
1
| 24,994 |
s491425223 | p00780 | u633068244 | 1398079169 | Python | Python | py | Accepted | 50 | 5004 | 264 | r = 2**15+1
sqrt = int(r**0.5)
p = [1]*(r+1)
p[:2] = [0,0]
for i in range(2,sqrt+1):
if p[i]:
p[2*i::i] = [0 for x in range(2*i,r+1,i)]
while 1:
n = input()
if n == 0: break
count = 0
for i in range(2,n/2+1):
if p[i] and p[n-i]:
count += 1
print count | p00780 |
<H1><font color="#000">Problem A:</font>Goldbach's Conjecture</H1>
<p>
<b>Goldbach's Conjecture:</b> For any even number <i>n</i> greater than or equal to 4, there exists at least one pair of prime numbers <i>p</i><sub>1</sub> and <i>p</i><sub>2</sub> such that <i>n</i> = <i>p</i><sub>1</sub> + <i>p</i><sub>2</sub>.
... | 6
10
12
0
| 1
2
1
| 24,995 |
s047572969 | p00780 | u829520323 | 1597755263 | Python | Python3 | py | Accepted | 40 | 6052 | 369 | import bisect
primes = [0, 0] + [1] * 32767
for i in range(2, 182):
if primes[i]:
for j in range(i*i, 32769, i):
primes[j] = 0
prime_values = [i for i, v in enumerate(primes) if v]
while True:
n = int(input())
if n == 0:
break
eov = bisect.bisect(prime_values, n//2)
prin... | p00780 |
<H1><font color="#000">Problem A:</font>Goldbach's Conjecture</H1>
<p>
<b>Goldbach's Conjecture:</b> For any even number <i>n</i> greater than or equal to 4, there exists at least one pair of prime numbers <i>p</i><sub>1</sub> and <i>p</i><sub>2</sub> such that <i>n</i> = <i>p</i><sub>1</sub> + <i>p</i><sub>2</sub>.
... | 6
10
12
0
| 1
2
1
| 24,996 |
s079712069 | p00780 | u497248335 | 1597670031 | Python | Python3 | py | Accepted | 50 | 6048 | 368 | import bisect
primes = [0, 0] + [1] * 32767
for i in range(2, 182):
if primes[i]:
for j in range(i*i, 32769, i):
primes[j] = 0
prime_values = [i for i, v in enumerate(primes) if v]
while True:
n = int(input())
if n == 0:
break
eov = bisect.bisect(prime_values, n//2)
prin... | p00780 |
<H1><font color="#000">Problem A:</font>Goldbach's Conjecture</H1>
<p>
<b>Goldbach's Conjecture:</b> For any even number <i>n</i> greater than or equal to 4, there exists at least one pair of prime numbers <i>p</i><sub>1</sub> and <i>p</i><sub>2</sub> such that <i>n</i> = <i>p</i><sub>1</sub> + <i>p</i><sub>2</sub>.
... | 6
10
12
0
| 1
2
1
| 24,997 |
s326920255 | p00780 | u919773430 | 1597033940 | Python | Python3 | py | Accepted | 50 | 6044 | 368 | import bisect
primes = [0, 0] + [1] * 32767
for i in range(2, 182):
if primes[i]:
for j in range(i*i, 32769, i):
primes[j] = 0
prime_values = [i for i, v in enumerate(primes) if v]
while True:
n = int(input())
if n == 0:
break
eov = bisect.bisect(prime_values, n//2)
prin... | p00780 |
<H1><font color="#000">Problem A:</font>Goldbach's Conjecture</H1>
<p>
<b>Goldbach's Conjecture:</b> For any even number <i>n</i> greater than or equal to 4, there exists at least one pair of prime numbers <i>p</i><sub>1</sub> and <i>p</i><sub>2</sub> such that <i>n</i> = <i>p</i><sub>1</sub> + <i>p</i><sub>2</sub>.
... | 6
10
12
0
| 1
2
1
| 24,998 |
s928543624 | p00782 | u847467233 | 1532755082 | Python | Python3 | py | Accepted | 70 | 6304 | 893 | # AOJ 1202: Mobile Phone Coverage
# Python3 2018.7.28
from bisect import bisect_left
cno = 0
while True:
n = int(input())
if n == 0: break
tbl, xx, yy = [], set(), set()
for i in range(n):
x, y, r = map(float, input().split())
x, y, r = int(100*x), int(100*y), int(100*r)
x1, y1, x2, y2 = x-r, y-r, x+r, y+r
... | p00782 |
<H1><font color="#000">Problem C:</font>Mobile Phone Coverage</H1>
<p>
A mobile phone company ACMICPC (Advanced Cellular, Mobile, and Internet-Connected Phone Corporation) is planning to set up a collection of antennas for mobile phones in a city called Maxnorm. The company ACMICPC has several collections for locatio... | 3
4.0 4.0 3.0
5.0 6.0 3.0
5.5 4.5 1.0
2
3.0 3.0 3.0
1.5 1.5 1.0
0
| 1 52.00
2 36.00
| 24,999 |
s311641885 | p00788 | u260980560 | 1560874210 | Python | Python3 | py | Accepted | 70 | 5636 | 751 | import sys
readline = sys.stdin.readline
write = sys.stdout.write
def stern_brocot(p, n):
la = 0; lb = 1
ra = 1; rb = 0
lu = ru = 1
lx = 0; ly = 1
rx = 1; ry = 0
while lu or ru:
ma = la + ra; mb = lb + rb
if p * mb**2 < ma**2:
ra = ma; rb = mb
if ma <= n ... | p00788 |
<H1><font color="#000">Problem A:</font> Rational Irrationals</H1>
<p>
Rational numbers are numbers represented by ratios of two integers. For a prime number <i>p</i>, one of the elementary theorems in the number theory is that there is no rational number equal to √<i>p</i>. Such numbers are called irrational n... | 2 5
3 10
5 100
0 0
| 3/2 4/3
7/4 5/3
85/38 38/17
| 25,000 |
s546292881 | p00789 | u847467233 | 1531993983 | Python | Python3 | py | Accepted | 20 | 5600 | 211 | # AOJ 1209: Square Coins
#Python3 2018.7.19 bal4u
dp = [1]*300
for i in range(2, 18):
for j in range(i**2, 300): dp[j] += dp[j-i**2]
while True:
n = int(input())
if n == 0: break
print(dp[n])
| p00789 |
<H1><font color="#000">Problem B:</font> Square Coins</H1>
<p>
People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (= 17<sup>2</sup>), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ..., and 289-cred... | 2
10
30
0
| 1
4
27
| 25,001 |
s201583933 | p00789 | u078042885 | 1484931677 | Python | Python3 | py | Accepted | 30 | 7628 | 140 | dp=[1]*301
for i in range(2,18):
for j in range(i*i,301):dp[j]+=dp[j-i*i]
while 1:
n=int(input())
if n==0:break
print(dp[n]) | p00789 |
<H1><font color="#000">Problem B:</font> Square Coins</H1>
<p>
People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (= 17<sup>2</sup>), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ..., and 289-cred... | 2
10
30
0
| 1
4
27
| 25,002 |
s843706708 | p00789 | u633068244 | 1399606974 | Python | Python | py | Accepted | 20 | 4208 | 143 | dp = [1] + [0]*300
for c in range(1,18):
for i in range(301-c**2):
dp[i+c**2] += dp[i]
while 1:
n = input()
if n == 0: break
print dp[n] | p00789 |
<H1><font color="#000">Problem B:</font> Square Coins</H1>
<p>
People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (= 17<sup>2</sup>), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ..., and 289-cred... | 2
10
30
0
| 1
4
27
| 25,003 |
s900543720 | p00789 | u525395303 | 1564719495 | Python | Python3 | py | Accepted | 30 | 5600 | 212 | # AOJ 1209: Square Coins
#Python3 2018.7.19 bal4u
dp = [1]*300
for i in range(2, 18):
for j in range(i**2, 300): dp[j] += dp[j-i**2]
while True:
n = int(input())
if n == 0: break
print(dp[n])
| p00789 |
<H1><font color="#000">Problem B:</font> Square Coins</H1>
<p>
People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (= 17<sup>2</sup>), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ..., and 289-cred... | 2
10
30
0
| 1
4
27
| 25,004 |
s355634627 | p00789 | u260980560 | 1560961927 | Python | Python3 | py | Accepted | 70 | 5600 | 402 | import sys
readline = sys.stdin.readline
write = sys.stdout.write
dp = [0]*601
dp[0] = 1
V = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289]
for v in V:
for k in range(300, -1, -1):
x = dp[k]
w = v
while k+w <= 300:
dp[k+w] += x
w += v
while... | p00789 |
<H1><font color="#000">Problem B:</font> Square Coins</H1>
<p>
People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (= 17<sup>2</sup>), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ..., and 289-cred... | 2
10
30
0
| 1
4
27
| 25,005 |
s707911842 | p00790 | u633068244 | 1399799130 | Python | Python | py | Accepted | 20 | 4260 | 339 | while 1:
n = input()
if n == 0:break
D = range(1,7)
ans = set(D)
for i in range(n):
c = raw_input()[0]
if c == "s": S = [1,5,2,3,0,4]
elif c == "n": S = [4,0,2,3,5,1]
elif c == "w": S = [3,1,0,5,4,2]
elif c == "e": S = [2,1,5,0,4,3]
D = [D[s] for s i... | p00790 |
<H1><font color="#000">Problem C:</font> Die Game</H1>
<p>
Life is not easy. Sometimes it is beyond your control. Now, as contestants of ACM ICPC, you might be just tasting the bitter of life. But don't worry! Do not look only on the dark side of life, but look also on the bright side. Life may be an enjoyable game o... | 1
north
3
north
east
south
0
| 5
1
| 25,006 |
s765061043 | p00790 | u633068244 | 1399799217 | Python | Python | py | Accepted | 10 | 4256 | 271 | while 1:
n = input()
if n == 0:break
D = range(1,7)
for i in range(n):
c = raw_input()[0]
if c == "s": S = [1,5,2,3,0,4]
elif c == "n": S = [4,0,2,3,5,1]
elif c == "w": S = [3,1,0,5,4,2]
elif c == "e": S = [2,1,5,0,4,3]
D = [D[s] for s in S]
print D[0] | p00790 |
<H1><font color="#000">Problem C:</font> Die Game</H1>
<p>
Life is not easy. Sometimes it is beyond your control. Now, as contestants of ACM ICPC, you might be just tasting the bitter of life. But don't worry! Do not look only on the dark side of life, but look also on the bright side. Life may be an enjoyable game o... | 1
north
3
north
east
south
0
| 5
1
| 25,007 |
s881358870 | p00790 | u847467233 | 1532257332 | Python | Python3 | py | Accepted | 30 | 5608 | 381 | # AOJ 1210: Die Game
# Python3 2018.7.22 bal4u
dic = {'s':1, 'w':2, 'e':3, 'n':4}
rot = [[0,1,2,3,4,5,6],[0,2,6,3,4,1,5],[0,4,2,1,6,5,3],[0,3,2,6,1,5,4],[0,5,1,3,4,6,2]]
while True:
n = int(input())
if n == 0: break
dice = [i for i in range(7)]
for j in range(n):
a = input()[0]
dice =... | p00790 |
<H1><font color="#000">Problem C:</font> Die Game</H1>
<p>
Life is not easy. Sometimes it is beyond your control. Now, as contestants of ACM ICPC, you might be just tasting the bitter of life. But don't worry! Do not look only on the dark side of life, but look also on the bright side. Life may be an enjoyable game o... | 1
north
3
north
east
south
0
| 5
1
| 25,008 |
s506462635 | p00803 | u633068244 | 1399607430 | Python | Python | py | Accepted | 100 | 4344 | 177 | while 1:
n = input()
if n == 0: break
ans = 0
for i in range(96):
tri = i*(i+1)*(i+2)/6
if tri > n: break
ans = max(ans,int((n-tri)**(1.0/3)+1e-8)**3 + tri)
print ans | p00803 |
<H1><font color="#000">Problem A:</font> Starship Hakodate-maru</H1>
<p>
The surveyor starship Hakodate-maru is famous for her two fuel containers with unbounded capacities. They hold the same type of atomic fuel balls.
</p>
<p>
There, however, is an inconvenience. The shapes of the fuel containers <i>#</i>1 and <i>#... | 100
64
50
20
151200
0
| 99
64
47
20
151200
| 25,009 |
s367717311 | p00803 | u633068244 | 1399607497 | Python | Python | py | Accepted | 100 | 4348 | 169 | while 1:
n = input()
if n == 0: break
ans = 0
for i in range(96):
t = i*(i+1)*(i+2)/6
if t > n: break
ans = max(ans,int((n-t)**(1.0/3)+1e-8)**3 + t)
print ans | p00803 |
<H1><font color="#000">Problem A:</font> Starship Hakodate-maru</H1>
<p>
The surveyor starship Hakodate-maru is famous for her two fuel containers with unbounded capacities. They hold the same type of atomic fuel balls.
</p>
<p>
There, however, is an inconvenience. The shapes of the fuel containers <i>#</i>1 and <i>#... | 100
64
50
20
151200
0
| 99
64
47
20
151200
| 25,010 |
s499427615 | p00803 | u633068244 | 1399607619 | Python | Python | py | Accepted | 100 | 4348 | 190 | while 1:
n = input()
if n == 0: break
ans = 0
for i in range(96):
t = i*(i+1)*(i+2)/6
if t > n: break
ans = max(ans,int((n-t)**(1.0/3)+1e-8)**3 + t)
if ans == n: break
print ans | p00803 |
<H1><font color="#000">Problem A:</font> Starship Hakodate-maru</H1>
<p>
The surveyor starship Hakodate-maru is famous for her two fuel containers with unbounded capacities. They hold the same type of atomic fuel balls.
</p>
<p>
There, however, is an inconvenience. The shapes of the fuel containers <i>#</i>1 and <i>#... | 100
64
50
20
151200
0
| 99
64
47
20
151200
| 25,011 |
s741542738 | p00814 | u509278866 | 1535537379 | Python | Python3 | py | Accepted | 70 | 9096 | 3,548 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.... | p00814 | <H1><font color="#000">Problem D:</font> Life Line</H1>
<p>
Let's play a new board game ``Life Line''.
</p>
<p>
The number of the players is greater than 1 and less than 10.
</p>
<p>
In this game, the board is a regular triangle in which many small regular triangles are arranged (See Figure l). The edges of each small... | 4 4
2
2 3
1 0 4
1 1 4 0
4 5
2
2 3
3 0 4
1 1 4 0
4 1
2
2 3
3 0 4
1 1 4 0
4 1
1
1 1
1 1 1
1 1 1 0
4 2
1
1 1
1 1 1
1 1 1 0
4 1
0
2 2
5 0 7
0 5 7 0
4 2
0
0 3
1 0 4
0 1 0 4
4 3
0
3 3
3 2 3
0 3 0 3
4 2
0
3 3
3 2 3
0 3 0 3
6 1
1
1 2
1 1 0
6 7 6 8
0 7 6 8 2
6... | 6
5
1
-10
8
-1
0
1
-1
5
0
5
| 25,012 |
s215116336 | p00814 | u467175809 | 1530007031 | Python | Python | py | Accepted | 50 | 4996 | 1,546 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
while True:
N, C = map(int, raw_input().split())
if N == 0:
break
S = []
for loop in range(N):
lst = map(int, raw_input().split())
S.append(lst)
used = {}
... | p00814 | <H1><font color="#000">Problem D:</font> Life Line</H1>
<p>
Let's play a new board game ``Life Line''.
</p>
<p>
The number of the players is greater than 1 and less than 10.
</p>
<p>
In this game, the board is a regular triangle in which many small regular triangles are arranged (See Figure l). The edges of each small... | 4 4
2
2 3
1 0 4
1 1 4 0
4 5
2
2 3
3 0 4
1 1 4 0
4 1
2
2 3
3 0 4
1 1 4 0
4 1
1
1 1
1 1 1
1 1 1 0
4 2
1
1 1
1 1 1
1 1 1 0
4 1
0
2 2
5 0 7
0 5 7 0
4 2
0
0 3
1 0 4
0 1 0 4
4 3
0
3 3
3 2 3
0 3 0 3
4 2
0
3 3
3 2 3
0 3 0 3
6 1
1
1 2
1 1 0
6 7 6 8
0 7 6 8 2
6... | 6
5
1
-10
8
-1
0
1
-1
5
0
5
| 25,013 |
s009637617 | p00814 | u668489394 | 1579564515 | Python | Python3 | py | Accepted | 40 | 5648 | 3,195 | class Tree:
def __init__(self, N):
self.N = N
self.arr = [ [ None for _ in range(N) ] for _ in range(N) ]
def duplicate(self):
newTree = Tree(self.N)
for i in range(N):
row = self.arr[i]
newTree.arr[i] = row[:]
return newTree
def setVal(self,... | p00814 | <H1><font color="#000">Problem D:</font> Life Line</H1>
<p>
Let's play a new board game ``Life Line''.
</p>
<p>
The number of the players is greater than 1 and less than 10.
</p>
<p>
In this game, the board is a regular triangle in which many small regular triangles are arranged (See Figure l). The edges of each small... | 4 4
2
2 3
1 0 4
1 1 4 0
4 5
2
2 3
3 0 4
1 1 4 0
4 1
2
2 3
3 0 4
1 1 4 0
4 1
1
1 1
1 1 1
1 1 1 0
4 2
1
1 1
1 1 1
1 1 1 0
4 1
0
2 2
5 0 7
0 5 7 0
4 2
0
0 3
1 0 4
0 1 0 4
4 3
0
3 3
3 2 3
0 3 0 3
4 2
0
3 3
3 2 3
0 3 0 3
6 1
1
1 2
1 1 0
6 7 6 8
0 7 6 8 2
6... | 6
5
1
-10
8
-1
0
1
-1
5
0
5
| 25,014 |
s415739499 | p00815 | u921537862 | 1592912287 | Python | Python3 | py | Accepted | 40 | 5984 | 1,524 | import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
def solve():
record = list(map(int,input().split()))
while record[-1] != 0:
record += list(map(int,input().split()))
number_of_room = sum(1 if r > 0 else 0 for r in record) + 1
G = [[] for _ in range(number_of_room)]
... | p00815 | <H1><font color="#000">Problem E:</font> Map of Ninja House</H1>
<p>
An old document says that a Ninja House in Kanazawa City was in fact a defensive fortress, which was designed like a maze. Its rooms were connected by hidden doors in a complicated manner, so that any invader would become lost. Each room has at least... | 2
3 3 3 3 -3 3 2 -5 3 2 -5 -3 0
3 5 4 -2 4 -3 -2 -2 -1 0
| 1 2 4 6
2 1 3 8
3 2 4 7
4 1 3 5
5 4 6 7
6 1 5
7 3 5 8
8 2 7
1 2 3 4
2 1 3 3 4 4
3 1 2 2 4
4 1 2 2 3
| 25,015 |
s609300042 | p00815 | u260980560 | 1584202471 | Python | Python3 | py | Accepted | 30 | 5968 | 931 | N = int(input())
for i in range(N):
L = []
while 1:
*s, = map(int, input().split())
if s[-1] == 0:
L.extend(s[:-1])
break
L.extend(s)
G = []
st = []
cur = 0
for s in L:
if s > 0:
G.append([])
if st:
u... | p00815 | <H1><font color="#000">Problem E:</font> Map of Ninja House</H1>
<p>
An old document says that a Ninja House in Kanazawa City was in fact a defensive fortress, which was designed like a maze. Its rooms were connected by hidden doors in a complicated manner, so that any invader would become lost. Each room has at least... | 2
3 3 3 3 -3 3 2 -5 3 2 -5 -3 0
3 5 4 -2 4 -3 -2 -2 -1 0
| 1 2 4 6
2 1 3 8
3 2 4 7
4 1 3 5
5 4 6 7
6 1 5
7 3 5 8
8 2 7
1 2 3 4
2 1 3 3 4 4
3 1 2 2 4
4 1 2 2 3
| 25,016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.