s_id string | p_id string | u_id string | date string | language string | original_language string | filename_ext string | status string | cpu_time string | memory string | code_size string | code string | error string | stdout string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s706272158 | p02305 | u893844544 | 1523845762 | Python | Python3 | py | Runtime Error | 30 | 5668 | 300 | import math
c1x,c1y,c1r = [int(i) for i in input().split()]
c2x,c2y,c2r = [int(i) for i in input().split()]
d = math.sqrt(pow(c1x-c2x, 2) + pow(c1y-c2y, 2))
if d > c1r + c2r:
print(4)
elif d == c1r + c2r:
print(3)
elif d > s/2:
print(2)
elif d == s/2:
print(1)
else:
print(0)
| Traceback (most recent call last):
File "/tmp/tmp40s_a6ao/tmptqcefhvn.py", line 3, in <module>
c1x,c1y,c1r = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s751945220 | p02305 | u893844544 | 1523857127 | Python | Python3 | py | Runtime Error | 0 | 0 | 424 |
nv,ne = [int(i) for i in input().split()]
g = []
for i in range(nv):
g.append([])
for i in range(ne):
s,t = [int(j) for j in input().split()]
g[s].append(t)
done = []
f = 0
def put_forword(index):
global f
if index in done:
return
done.append(index)
for s in g[index]:
if s == 0:
f = 1
return
put_forword(s)
put_forword(0)
print(f)
| Traceback (most recent call last):
File "/tmp/tmpbwfiphkz/tmp06w03zuh.py", line 4, in <module>
nv,ne = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s909243716 | p02305 | u893844544 | 1523857319 | Python | Python3 | py | Runtime Error | 0 | 0 | 422 |
nv,ne = [int(i) for i in input().split()]
g = []
for i in range(nv):
g.append([])
for i in range(ne):
s,t = [int(j) for j in input().split()]
g[s].append(t)
done = []
f = 0
def put_forword(index):
global f
if index in done:
return
done.append(index)
for i in g[index]:
if i == 0:
f = 1
return
put_forword(i)
put_forword(0)
print(f)
| Traceback (most recent call last):
File "/tmp/tmppxquglh9/tmpff8exgun.py", line 2, in <module>
nv,ne = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s737092600 | p02305 | u893844544 | 1524435963 | Python | Python3 | py | Runtime Error | 0 | 0 | 462 |
nv,ne = [int(i) for i in input().split()]
g = [[] for i in range(nv)]
for i in range(ne):
s,t = [int(j) for j in input().split()]
g[s].append(t)
visited = [False for i in range(nv)]
f = 0
def pursue_from(index):
global f
if visited[index]:
return
visited[index] = True
for next_index in g[index]:
if next_index == 0:
f = 1
return
pursue_from(next_index)
pursue_from(0)
print(f)
| Traceback (most recent call last):
File "/tmp/tmpbvdhiv_g/tmpl6t4w9h5.py", line 2, in <module>
nv,ne = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s500849879 | p02308 | u629780968 | 1546439481 | Python | Python3 | py | Runtime Error | 0 | 0 | 836 | import math
def dot(a, b):
return a.real * b.real + a.imag * b.imag
def projection(p0,p1,p2):
a=p1-p0
b=p2-p0
pro = a * dot(a, b) / (abs(a) ** 2)
t=p0+pro
return t
def get_cross_point(p0,p1,p2):
pro=projection(p0,p1,p2)
e =(p1-p0)/abs(p1-p0)
base = math.sqrt(r*r-(abs(pro-p2)**2))
if pro-e*base.real == pro+e*base.real:
ans1=min(pro-e*base,pro+e*base,key=lambda x:x.image)
ans2=max(pro-e*base,pro+e*base,key=lambda x:x.image)
else:
ans1=min(pro-e*base,pro+e*base,key=lambda x:x.real)
ans2=max(pro-e*base,pro+e*base,key=lambda x:x.real)
return ans1.real, ans1.imag,ans2.real,ans2.imag
cx, cy, r = map(int, input().split())
p2=complex(cx,cy)
q = int(input())
for _ in range(q):
x0,y0,x1,y1=map(int,input().split())
p0=complex(x0,y0)
p1=complex(x1,y1)
print(*get_cross_point(p0,p1,p2))
| Traceback (most recent call last):
File "/tmp/tmp30pp43e_/tmph8xmrknk.py", line 25, in <module>
cx, cy, r = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s191020671 | p02308 | u879226672 | 1432488984 | Python | Python | py | Runtime Error | 10 | 4448 | 938 | # coding: utf-8
import math
def solve(a,b,c):
# square equation ax**2 + 2b*x + c == 0
return (-b - math.sqrt(b**2 - a*c)) / a, (-b + math.sqrt(b**2 - a*c)) / a
x0, y0, r = map(float, raw_input().split())
q = int(raw_input())
for i in range(q):
x1, y1, x2, y2 = map(float, raw_input().split())
# line: y = mx + n
# (x - x0)**2 + (y - y0)**2 == r**2
# erase y
# cross points A and B
if x1 - x2 == 0: # x1 == x2
XA = x1
XB = x2
YA = y0 + math.sqrt(r**2 - (x1 - x0)**2)
YB = y0 - math.sqrt(r**2 - (x1 - x0)**2)
print XA, YA, XB, YB
else:
m = (y1-y2) / (x1-x2)
n = (2*x1*y1 - x2*y1 - x1*y2) / (x1-x2)
a_solve = m**2 + 1
b_solve = m*(n - y0) - x0
c_solve = x0**2 + (n - y0)**2 - r**2
XA, XB = solve(a_solve, b_solve, c_solve)
YA = m * XA + n
YB = m * XB + n
print XA, YA, XB, YB
| File "/tmp/tmpx2appo43/tmp9ljbwfub.py", line 22
print XA, YA, XB, YB
^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s564471406 | p02308 | u879226672 | 1432489112 | Python | Python | py | Runtime Error | 10 | 4452 | 990 | # coding: utf-8
import math
def solve(a,b,c):
# square equation ax**2 + 2b*x + c == 0
return (-b - math.sqrt(b**2 - a*c)) / a, (-b + math.sqrt(b**2 - a*c)) / a
x0, y0, r = map(float, raw_input().split())
q = int(raw_input())
for i in range(q):
x1, y1, x2, y2 = map(float, raw_input().split())
# line: y = mx + n
# (x - x0)**2 + (y - y0)**2 == r**2
# erase y
# cross points A and B
if x1 - x2 == 0: # x1 == x2
XA = x1
XB = x2
YA = y0 + math.sqrt(r**2 - (x1 - x0)**2)
YB = y0 - math.sqrt(r**2 - (x1 - x0)**2)
print "%.8f %.8f %.8f %.8f" % (XA, YA, XB, YB)
else:
m = (y1-y2) / (x1-x2)
n = (2*x1*y1 - x2*y1 - x1*y2) / (x1-x2)
a_solve = m**2 + 1
b_solve = m*(n - y0) - x0
c_solve = x0**2 + (n - y0)**2 - r**2
XA, XB = solve(a_solve, b_solve, c_solve)
YA = m * XA + n
YB = m * XB + n
print "%.8f %.8f %.8f %.8f" % (XA, YA, XB, YB)
| File "/tmp/tmpzjnuwjfz/tmptrdzrt78.py", line 22
print "%.8f %.8f %.8f %.8f" % (XA, YA, XB, YB)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s194054685 | p02308 | u879226672 | 1432489259 | Python | Python | py | Runtime Error | 10 | 4452 | 970 | import math
def solve(a,b,c):
# square equation ax**2 + 2*b*x + c == 0
return (-b - math.sqrt(b**2 - a*c)) / a, (-b + math.sqrt(b**2 - a*c)) / a
x0, y0, r = map(float, raw_input().split())
q = int(raw_input())
for i in range(q):
x1, y1, x2, y2 = map(float, raw_input().split())
# line: y = mx + n
# (x - x0)**2 + (y - y0)**2 == r**2
# erase y
# cross points A and B
if x1 - x2 == 0: # x1 == x2
XA = x1
XB = x2
YA = y0 + math.sqrt(r**2 - (x1 - x0)**2)
YB = y0 - math.sqrt(r**2 - (x1 - x0)**2)
print "%.8f %.8f %.8f %.8f" % (XA, YA, XB, YB)
else:
m = (y1-y2) / (x1-x2)
n = (2*x1*y1 - x2*y1 - x1*y2) / (x1-x2)
a_solve = m**2 + 1
b_solve = m*(n - y0) - x0
c_solve = x0**2 + (n - y0)**2 - r**2
XA, XB = solve(a_solve, b_solve, c_solve)
YA = m * XA + n
YB = m * XB + n
print "%.8f %.8f %.8f %.8f" % (XA, YA, XB, YB) | File "/tmp/tmpuc4vdebl/tmp8qe8ukyo.py", line 21
print "%.8f %.8f %.8f %.8f" % (XA, YA, XB, YB)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s142482820 | p02308 | u879226672 | 1432489936 | Python | Python | py | Runtime Error | 10 | 4460 | 1107 | # coding: utf-8
import math
def solve(a,b,c):
# square equation ax**2 + 2*b*x + c == 0
return (-b - math.sqrt(b**2 - a*c)) / a, (-b + math.sqrt(b**2 - a*c)) / a
x0, y0, r = map(float, raw_input().split())
q = int(raw_input())
for i in range(q):
x1, y1, x2, y2 = map(float, raw_input().split())
# line: y = mx + n
# (x - x0)**2 + (y - y0)**2 == r**2
# erase y
# cross points A and B
if x1 - x2 == 0: # x1 == x2
XA = x1
XB = x2
YA = y0 + math.sqrt(r**2 - (x1 - x0)**2)
YB = y0 - math.sqrt(r**2 - (x1 - x0)**2)
print "%.9f %.9f %.9f %.9f" % (XA, YA, XB, YB)
else:
m = (y1 - y2) / (x1 - x2)
n = (2*x1*y1 - x2*y1 - x1*y2) / (x1 - x2)
a_solve = m**2 + 1
b_solve = m*(n - y0) - x0
c_solve = x0**2 + (n - y0)**2 - r**2
XA, XB = solve(a_solve, b_solve, c_solve)
YA = m * XA + n
YB = m * XB + n
if XA == XB and YA > YB:
print "%.9f %.9f %.9f %.9f" % (XB, YB, XA, YA)
else:
print "%.9f %.9f %.9f %.9f" % (XA, YA, XB, YB)
| File "/tmp/tmpk_gl14ke/tmp48xun9ln.py", line 22
print "%.9f %.9f %.9f %.9f" % (XA, YA, XB, YB)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s166098308 | p02308 | u879226672 | 1432490823 | Python | Python | py | Runtime Error | 10 | 4496 | 1394 | # coding: utf-8
import math
def solve(a,b,c):
# square equation ax**2 + 2*b*x + c == 0
return (-b - math.sqrt(b**2 - a*c)) / a, (-b + math.sqrt(b**2 - a*c)) / a
x0, y0, r = map(float, raw_input().split())
q = int(raw_input())
for i in range(q):
x1, y1, x2, y2 = map(float, raw_input().split())
# line: y = mx + n
# (x - x0)**2 + (y - y0)**2 == r**2
# erase y
# cross points A and B
if x1 - x2 == 0: # x1 == x2
XA = x1
XB = x2
YA = y0 + math.sqrt(r**2 - (x1 - x0)**2)
YB = y0 - math.sqrt(r**2 - (x1 - x0)**2)
if XA < 0.000001: XA = 0
if YA < 0.000001: YA = 0
if XB < 0.000001: XB = 0
if YB < 0.000001: YB = 0
print "%.8f %.8f %.8f %.8f" % (XA, YA, XB, YB)
else:
m = (y1 - y2) / (x1 - x2)
n = (2*x1*y1 - x2*y1 - x1*y2) / (x1 - x2)
a_solve = m**2 + 1
b_solve = m*(n - y0) - x0
c_solve = x0**2 + (n - y0)**2 - r**2
XA, XB = solve(a_solve, b_solve, c_solve)
YA = m * XA + n
YB = m * XB + n
if XA < 0.000001: XA = 0
if YA < 0.000001: YA = 0
if XB < 0.000001: XB = 0
if YB < 0.000001: YB = 0
if XA == XB and YA > YB:
print "%.9f %.9f %.9f %.9f" % (XB, YB, XA, YA)
else:
print "%.9f %.9f %.9f %.9f" % (XA, YA, XB, YB)
| File "/tmp/tmpwct94ld0/tmp2h3igp3j.py", line 28
print "%.8f %.8f %.8f %.8f" % (XA, YA, XB, YB)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s640920885 | p02308 | u879226672 | 1432490879 | Python | Python | py | Runtime Error | 10 | 4496 | 1402 | # coding: utf-8
import math
def solve(a,b,c):
# square equation ax**2 + 2*b*x + c == 0
return (-b - math.sqrt(b**2 - a*c)) / a, (-b + math.sqrt(b**2 - a*c)) / a
x0, y0, r = map(float, raw_input().split())
q = int(raw_input())
for i in range(q):
x1, y1, x2, y2 = map(float, raw_input().split())
# line: y = mx + n
# (x - x0)**2 + (y - y0)**2 == r**2
# erase y
# cross points A and B
if x1 - x2 == 0: # x1 == x2
XA = x1
XB = x2
YA = y0 + math.sqrt(r**2 - (x1 - x0)**2)
YB = y0 - math.sqrt(r**2 - (x1 - x0)**2)
if XA < 0.0000001: XA = 0
if YA < 0.0000001: YA = 0
if XB < 0.0000001: XB = 0
if YB < 0.0000001: YB = 0
print "%.8f %.8f %.8f %.8f" % (XA, YA, XB, YB)
else:
m = (y1 - y2) / (x1 - x2)
n = (2*x1*y1 - x2*y1 - x1*y2) / (x1 - x2)
a_solve = m**2 + 1
b_solve = m*(n - y0) - x0
c_solve = x0**2 + (n - y0)**2 - r**2
XA, XB = solve(a_solve, b_solve, c_solve)
YA = m * XA + n
YB = m * XB + n
if XA < 0.0000001: XA = 0
if YA < 0.0000001: YA = 0
if XB < 0.0000001: XB = 0
if YB < 0.0000001: YB = 0
if XA == XB and YA > YB:
print "%.9f %.9f %.9f %.9f" % (XB, YB, XA, YA)
else:
print "%.9f %.9f %.9f %.9f" % (XA, YA, XB, YB)
| File "/tmp/tmp9pelprnc/tmp__xx3w83.py", line 28
print "%.8f %.8f %.8f %.8f" % (XA, YA, XB, YB)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s812550482 | p02308 | u879226672 | 1432490971 | Python | Python | py | Runtime Error | 20 | 4500 | 1394 | # coding: utf-8
import math
def solve(a,b,c):
# square equation ax**2 + 2*b*x + c == 0
return (-b - math.sqrt(b**2 - a*c)) / a, (-b + math.sqrt(b**2 - a*c)) / a
x0, y0, r = map(float, raw_input().split())
q = int(raw_input())
for i in range(q):
x1, y1, x2, y2 = map(float, raw_input().split())
# line: y = mx + n
# (x - x0)**2 + (y - y0)**2 == r**2
# erase y
# cross points A and B
if x1 - x2 == 0: # x1 == x2
XA = x1
XB = x2
YA = y0 + math.sqrt(r**2 - (x1 - x0)**2)
YB = y0 - math.sqrt(r**2 - (x1 - x0)**2)
if XA < 0.000001: XA = 0
if YA < 0.000001: YA = 0
if XB < 0.000001: XB = 0
if YB < 0.000001: YB = 0
print "%.6f %.6f %.6f %.6f" % (XA, YA, XB, YB)
else:
m = (y1 - y2) / (x1 - x2)
n = (2*x1*y1 - x2*y1 - x1*y2) / (x1 - x2)
a_solve = m**2 + 1
b_solve = m*(n - y0) - x0
c_solve = x0**2 + (n - y0)**2 - r**2
XA, XB = solve(a_solve, b_solve, c_solve)
YA = m * XA + n
YB = m * XB + n
if XA < 0.000001: XA = 0
if YA < 0.000001: YA = 0
if XB < 0.000001: XB = 0
if YB < 0.000001: YB = 0
if XA == XB and YA > YB:
print "%.6f %.6f %.6f %.6f" % (XB, YB, XA, YA)
else:
print "%.6f %.6f %.6f %.6f" % (XA, YA, XB, YB)
| File "/tmp/tmpl6u953w8/tmpn5k5z55v.py", line 28
print "%.6f %.6f %.6f %.6f" % (XA, YA, XB, YB)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s095278172 | p02308 | u879226672 | 1432491082 | Python | Python | py | Runtime Error | 10 | 4496 | 1357 | # coding: utf-8
import math
def solve(a,b,c):
# square equation ax**2 + 2*b*x + c == 0
return (-b - math.sqrt(b**2 - a*c)) / a, (-b + math.sqrt(b**2 - a*c)) / a
x0, y0, r = map(float, raw_input().split())
q = int(raw_input())
for i in range(q):
x1, y1, x2, y2 = map(float, raw_input().split())
# line: y = mx + n
# (x - x0)**2 + (y - y0)**2 == r**2
# erase y
# cross points A and B
if x1 - x2 == 0: # x1 == x2
XA = x1
XB = x2
YA = y0 + math.sqrt(r**2 - (x1 - x0)**2)
YB = y0 - math.sqrt(r**2 - (x1 - x0)**2)
if XA < 1e-6: XA = 0
if YA < 1e-6: YA = 0
if XB < 1e-6: XB = 0
if YB < 1e-6: YB = 0
print "%.6f %.6f %.6f %.6f" % (XA, YA, XB, YB)
else:
m = (y1 - y2) / (x1 - x2)
n = (2*x1*y1 - x2*y1 - x1*y2) / (x1 - x2)
a_solve = m**2 + 1
b_solve = m*(n - y0) - x0
c_solve = x0**2 + (n - y0)**2 - r**2
XA, XB = solve(a_solve, b_solve, c_solve)
YA = m * XA + n
YB = m * XB + n
if XA < 1e-6: XA = 0
if YA < 1e-6: YA = 0
if XB < 1e-6: XB = 0
if YB < 1e-6: YB = 0
if XA == XB and YA > YB:
print "%.6f %.6f %.6f %.6f" % (XB, YB, XA, YA)
else:
print "%.6f %.6f %.6f %.6f" % (XA, YA, XB, YB) | File "/tmp/tmpsc1n8zxu/tmpzil8jpb0.py", line 28
print "%.6f %.6f %.6f %.6f" % (XA, YA, XB, YB)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s974707156 | p02308 | u879226672 | 1432491158 | Python | Python | py | Runtime Error | 20 | 4500 | 1370 | # coding: utf-8
import math
def solve(a,b,c):
# square equation ax**2 + 2*b*x + c == 0
return (-b - math.sqrt(b**2 - a*c)) / a, (-b + math.sqrt(b**2 - a*c)) / a
x0, y0, r = map(float, raw_input().split())
q = int(raw_input())
for i in range(q):
x1, y1, x2, y2 = map(float, raw_input().split())
# line: y = mx + n
# (x - x0)**2 + (y - y0)**2 == r**2
# erase y
# cross points A and B
if x1 - x2 == 0: # x1 == x2
XA = x1
XB = x2
YA = y0 + math.sqrt(r**2 - (x1 - x0)**2)
YB = y0 - math.sqrt(r**2 - (x1 - x0)**2)
if XA <= 1e-6: XA = 0
if YA <= 1e-6: YA = 0
if XB <= 1e-6: XB = 0
if YB <= 1e-6: YB = 0
print "%.6f %.6f %.6f %.6f" % (XA, YA, XB, YB)
else:
m = (y1 - y2) / (x1 - x2)
n = (2*x1*y1 - x2*y1 - x1*y2) / (x1 - x2)
a_solve = m**2 + 1
b_solve = m*(n - y0) - x0
c_solve = x0**2 + (n - y0)**2 - r**2
XA, XB = solve(a_solve, b_solve, c_solve)
YA = m * XA + n
YB = m * XB + n
if XA <= 1e-6: XA = 0
if YA <= 1e-6: YA = 0
if XB <= 1e-6: XB = 0
if YB <= 1e-6: YB = 0
if XA == XB and YA > YB:
print "%.6f %.6f %.6f %.6f" % (XB, YB, XA, YA)
else:
print "%.6f %.6f %.6f %.6f" % (XA, YA, XB, YB)
| File "/tmp/tmputxt5s2s/tmpaabjtjee.py", line 28
print "%.6f %.6f %.6f %.6f" % (XA, YA, XB, YB)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s774543166 | p02308 | u879226672 | 1432524449 | Python | Python | py | Runtime Error | 10 | 4500 | 1370 | # coding: utf-8
import math
def solve(a,b,c):
# square equation ax**2 + 2*b*x + c == 0
return (-b - math.sqrt(b**2 - a*c)) / a, (-b + math.sqrt(b**2 - a*c)) / a
x0, y0, r = map(float, raw_input().split())
q = int(raw_input())
for i in range(q):
x1, y1, x2, y2 = map(float, raw_input().split())
# line: y = mx + n
# (x - x0)**2 + (y - y0)**2 == r**2
# erase y
# cross points A and B
if x1 - x2 == 0: # x1 == x2
XA = x1
XB = x2
YA = y0 + math.sqrt(r**2 - (x1 - x0)**2)
YB = y0 - math.sqrt(r**2 - (x2 - x0)**2)
if XA <= 1e-6: XA = 0
if YA <= 1e-6: YA = 0
if XB <= 1e-6: XB = 0
if YB <= 1e-6: YB = 0
print "%.6f %.6f %.6f %.6f" % (XA, YA, XB, YB)
else:
m = (y1 - y2) / (x1 - x2)
n = (2*x1*y1 - x2*y1 - x1*y2) / (x1 - x2)
a_solve = m**2 + 1
b_solve = m*(n - y0) - x0
c_solve = x0**2 + (n - y0)**2 - r**2
XA, XB = solve(a_solve, b_solve, c_solve)
YA = m * XA + n
YB = m * XB + n
if XA <= 1e-6: XA = 0
if YA <= 1e-6: YA = 0
if XB <= 1e-6: XB = 0
if YB <= 1e-6: YB = 0
if XA == XB and YA > YB:
print "%.6f %.6f %.6f %.6f" % (XB, YB, XA, YA)
else:
print "%.6f %.6f %.6f %.6f" % (XA, YA, XB, YB)
| File "/tmp/tmp2yo2n_hj/tmpvbghvw1q.py", line 28
print "%.6f %.6f %.6f %.6f" % (XA, YA, XB, YB)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s385698365 | p02308 | u662418022 | 1520747252 | Python | Python3 | py | Runtime Error | 0 | 0 | 2701 | # -*- coding: utf-8 -*-
import collections
import math
class Vector2(collections.namedtuple("Vector2", ["x", "y"])):
def __add__(self, other):
return Vector2(self.x + other.x, self.y + other.y)
def __sub__(self, other):
return Vector2(self.x - other.x, self.y - other.y)
def __mul__(self, scalar):
return Vector2(self.x * scalar, self.y * scalar)
def __neg__(self):
return Vector2(-self.x, -self.y)
def __pos__(self):
return Vector2(+self.x, +self.y)
def __abs__(self): # norm
return math.sqrt(float(self.x * self.x + self.y * self.y))
def __truediv__(self, scalar):
return Vector2(self.x/scalar, self.y/scalar)
def abs2(self):
return float(self.x * self.x + self.y * self.y)
def dot(self, other): # dot product
return self.x * other.x + self.y * other.y
def cross(self, other): # cross product
return self.x * other.y - self.y * other.x
def getDistanceSP(segment, point):
p = point
p1, p2 = segment
if (p2 - p1).dot(p - p1) < 0:
return abs(p - p1)
if (p1 - p2).dot(p - p2) < 0:
return abs(p - p2)
return abs((p2 - p1).cross(p - p1)) / abs(p2 - p1)
def getDistance(s1, s2):
a, b = s1
c, d = s2
if intersect(s1, s2): # intersect
return 0
return min(getDistanceSP(s1, c), getDistanceSP(s1, d), getDistanceSP(s2, a), getDistanceSP(s2, b))
def ccw(p0, p1, p2):
a = p1 - p0
b = p2 - p0
if a.cross(b) > 0:
return 1 # COUNTER_CLOCKWISE
elif a.cross(b) < 0:
return -1 # CLOCKWISE
elif a.dot(b) < 0:
return 2 # ONLINE_BACK
elif abs(a) < abs(b):
return -2 # ONLINE_FRONT
else:
return 0 # ON_SEGMENT
def intersect(s1, s2):
a, b = s1
c, d = s2
return ccw(a, b, c) * ccw(a, b, d) <= 0 and ccw(c, d, a) * ccw(c, d, b) <= 0
def project(l, p):
p1, p2 = l
base = p2 - p1
hypo = p - p1
return p1 + base * (hypo.dot(base) / abs(base)**2)
class Circle():
def __init__(self, c, r):
self.c = c
self.r = r
def getCrossPoints(c, l):
pr = project(l, c.c)
p1, p2 = l
e = (p2 - p1) / abs(p2 - p1))
base = math.sqrt(c.r*c.r - (pr - c.c).abs2())
return [pr + e * base, pr - e * base]
if __name__ == '__main__':
a, b, r = map(int, input().split())
c = Circle(Vector2(a, b), r)
n = int(input())
for _ in range(n):
ps = list(map(int, input().split()))
l = [Vector2(ps[0], ps[1]), Vector2(ps[2], ps[3])]
ans = getCrossPoints(c, l)
ans = sorted(ans, key=lambda x: (x.x, x.y))
print(ans[0].x, ans[0].y, ans[1].x, ans[1].y)
| File "/tmp/tmp4wg8frh2/tmpliznixwu.py", line 95
e = (p2 - p1) / abs(p2 - p1))
^
SyntaxError: unmatched ')'
| |
s099690808 | p02314 | u467175809 | 1531290907 | Python | Python | py | Runtime Error | 0 | 0 | 63 | n, m = map(int, raw_input())
c = map(int, raw_input())
print 0
| File "/tmp/tmpwx_4odnq/tmpcsoei71o.py", line 3
print 0
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s761584325 | p02314 | u467175809 | 1531290928 | Python | Python | py | Runtime Error | 0 | 0 | 79 | n, m = map(int, raw_input().split())
c = map(int, raw_input()_split())
print 0
| File "/tmp/tmpi4pa9l9e/tmpkwlsj1k_.py", line 2
c = map(int, raw_input()_split())
^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
| |
s535582547 | p02314 | u209989098 | 1531369723 | Python | Python3 | py | Runtime Error | 0 | 0 | 176 | a,b = map(int,input().split())
c = list(map(int,input().split()))
c.reversed()
su = 0
for i in range(b):
if a >= c[i]:
a %= c[i]
su += 1
print(su)
| Traceback (most recent call last):
File "/tmp/tmpibg6hylb/tmpwl7ii88t.py", line 1, in <module>
a,b = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s836509693 | p02314 | u209989098 | 1531371635 | Python | Python3 | py | Runtime Error | 0 | 0 | 260 | a,b = map(int,input().split())
c = list(map(int,input(),split()))
dp = [float("inf") for i in range(n+2)]
for i in range(n+1):
for j in c:
if i + j <= n:
dp[i+j] = min(dp[i+j],dp[i] + 1)
print(dp[a])
| Traceback (most recent call last):
File "/tmp/tmp43_ile3i/tmpwveepe1f.py", line 1, in <module>
a,b = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s206137037 | p02314 | u209989098 | 1531371656 | Python | Python3 | py | Runtime Error | 0 | 0 | 260 | a,b = map(int,input().split())
c = list(map(int,input().split()))
dp = [float("inf") for i in range(n+2)]
for i in range(n+1):
for j in c:
if i + j <= n:
dp[i+j] = min(dp[i+j],dp[i] + 1)
print(dp[a])
| Traceback (most recent call last):
File "/tmp/tmptujhpagz/tmpq7njk6iz.py", line 1, in <module>
a,b = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s131247020 | p02314 | u209989098 | 1531371665 | Python | Python3 | py | Runtime Error | 0 | 0 | 260 | a,b = map(int,input().split())
c = list(map(int,input().split()))
dp = [float("inf") for i in range(a+2)]
for i in range(n+1):
for j in c:
if i + j <= n:
dp[i+j] = min(dp[i+j],dp[i] + 1)
print(dp[a])
| Traceback (most recent call last):
File "/tmp/tmpa1u2rso3/tmpb14pyfzw.py", line 1, in <module>
a,b = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s911241948 | p02314 | u692132831 | 1545204785 | Python | Python3 | py | Runtime Error | 0 | 0 | 450 | def coin(a, b, c):
global count
global m
if a % c[0] == 0:
count = min(count, b + a // c[0])
return count
elif b + a // c[0] >= count:
return n
elif c[0] < n:
return min(cs(a - c[0], b + 1, c), cs(a, b, c[1:]))
else:
return coin(a, b, c[1:])
n, m = map(int, input().split())
money = sorted(list(map(int, input().split())), reverse = True)
count = print(coin(n, 0, money))
| Traceback (most recent call last):
File "/tmp/tmp578dfqxw/tmp240je0v6.py", line 25, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s957906106 | p02314 | u692132831 | 1545204830 | Python | Python3 | py | Runtime Error | 0 | 0 | 452 | def coin(a, b, c):
global count
global m
if a % c[0] == 0:
count = min(count, b + a // c[0])
return count
elif b + a // c[0] >= count:
return n
elif c[0] < n:
return min(coin(a - c[0], b + 1, c), cs(a, b, c[1:]))
else:
return coin(a, b, c[1:])
n, m = map(int, input().split())
money = sorted(list(map(int, input().split())), reverse = True)
count = print(coin(n, 0, money))
| Traceback (most recent call last):
File "/tmp/tmpqnw10rvx/tmpxk790ut5.py", line 25, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s661106963 | p02314 | u692132831 | 1545205169 | Python | Python3 | py | Runtime Error | 0 | 0 | 458 | def coin(a, b, c):
global count
global m
if a % c[0] == 0:
count = min(count, b + a // c[0])
return count
elif b + a // c[0] >= count:
return n
elif c[0] < n:
return min(coin(a - c[0], b + 1, c), coin(a, b, c[1:]))
else:
return coin(a, b, c[1:])
n, m = map(int, input().split())
money = sorted(list(map(int, input().split())), reverse = True)
count = n
print(coin(n, 0, money))
| Traceback (most recent call last):
File "/tmp/tmp0cqwk04u/tmpzk6sxrcs.py", line 25, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s114052425 | p02314 | u210992699 | 1556851973 | Python | Python3 | py | Runtime Error | 20 | 5720 | 198 | n, m =map(int,input().split())
c = list(map(int,input().split()))
INF = 10**10
dp = [INF]*50000
dp[0] = 0
for i in range (n+1):
for j in c:
dp[i+j] = min(dp[i+j],dp[i]+1)
print(dp[n])
| Traceback (most recent call last):
File "/tmp/tmp85rv1lsl/tmpnje0bb3w.py", line 1, in <module>
n, m =map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s988734870 | p02314 | u210992699 | 1556852137 | Python | Python3 | py | Runtime Error | 20 | 5720 | 198 | n, m =map(int,input().split())
c = list(map(int,input().split()))
INF = 10**10
dp = [INF]*50000
dp[0] = 0
for i in range (n+1):
for j in c:
dp[i+j] = min(dp[i+j],dp[i]+1)
print(dp[n])
| Traceback (most recent call last):
File "/tmp/tmpeh9uqf2e/tmpqof4lwd3.py", line 1, in <module>
n, m =map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s911098472 | p02314 | u210992699 | 1556852161 | Python | Python3 | py | Runtime Error | 20 | 5600 | 196 | n, m =map(int,input().split())
c = list(map(int,input().split()))
INF = 10**10
dp = [INF]*500
dp[0] = 0
for i in range (n+1):
for j in c:
dp[i+j] = min(dp[i+j],dp[i]+1)
print(dp[n])
| Traceback (most recent call last):
File "/tmp/tmpxllrsw_z/tmp4lz7dokh.py", line 1, in <module>
n, m =map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s189355921 | p02314 | u210992699 | 1556852211 | Python | Python3 | py | Runtime Error | 0 | 0 | 203 | n, m =map(int,input().split())
c = list(map(int,input().split()))
INF = 10**10
dp = [INF]*(n+max(c))
dp[0] = 0
for i in range (n+1):
for j in c:
dp[i+j] = min(dp[i+j],dp[i]+1)
print(dp[n])
| Traceback (most recent call last):
File "/tmp/tmpi2pqj6i1/tmpjvvl4bds.py", line 1, in <module>
n, m =map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s449925378 | p02314 | u210992699 | 1556852267 | Python | Python3 | py | Runtime Error | 20 | 5640 | 199 | n, m =map(int,input().split())
c = list(map(int,input().split()))
INF = 10**10
dp = [INF]*(n**2)
dp[0] = 0
for i in range (n+1):
for j in c:
dp[i+j] = min(dp[i+j],dp[i]+1)
print(dp[n])
| Traceback (most recent call last):
File "/tmp/tmp062nkx1e/tmpd1r6fil5.py", line 1, in <module>
n, m =map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s405954824 | p02314 | u106851363 | 1447905307 | Python | Python3 | py | Runtime Error | 0 | 0 | 320 | C = int(input().split()[0])
V = [int(i) for i in input().split()]
N = len(V)
M = [None for _ in range(C+1)]
for i in range(C+1):
M[i] = [0 for _ in range(N)]
for j in range(n):
M[0][j] = 0
for i in range(1, C+1):
for j in range(n):
M[i][j] = min([ (M[i-x*V[j]][j-1] + x) for x in range(C//V[j]) ])
print(M[-1][-1]) | Traceback (most recent call last):
File "/tmp/tmpd405_par/tmpva0uyssc.py", line 1, in <module>
C = int(input().split()[0])
^^^^^^^
EOFError: EOF when reading a line
| |
s587217561 | p02314 | u106851363 | 1447905671 | Python | Python3 | py | Runtime Error | 0 | 0 | 320 | C = int(input().split()[0])
V = [int(i) for i in input().split()]
N = len(V)
M = [None for _ in range(C+1)]
for i in range(C+1):
M[i] = [0 for _ in range(N)]
for j in range(n):
M[0][j] = 0
for i in range(1, C+1):
for j in range(N):
M[i][j] = min([ (M[i-x*V[j]][j-1] + x) for x in range(C//V[j]) ])
print(M[-1][-1]) | Traceback (most recent call last):
File "/tmp/tmpck_9c_8c/tmpp_105kh9.py", line 1, in <module>
C = int(input().split()[0])
^^^^^^^
EOFError: EOF when reading a line
| |
s418213276 | p02314 | u126202702 | 1448003631 | Python | Python | py | Runtime Error | 0 | 0 | 272 | n, m = map(int, raw_input().split())
c = map(int, raw_input().split())
t = [float('inf') for i in range(n+1)]
t[0] = 0
for i in range(n+1):
if c[i] > n:
break
else:
for j in range(c[i], n+1):
t[j] = min([t[j], t[j-c[i]]+1])
print t[n] | File "/tmp/tmp2hu_21bz/tmpk6tm_oyl.py", line 13
print t[n]
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s001192878 | p02314 | u126202702 | 1448003797 | Python | Python | py | Runtime Error | 0 | 0 | 270 | n, m = map(int, raw_input().split())
c = map(int, raw_input().split())
t = [float('inf') for i in range(n+1)]
t[0] = 0
for i in range(n):
if c[i] > n:
break
else:
for j in range(c[i], n+1):
t[j] = min([t[j], t[j-c[i]]+1])
print t[n] | File "/tmp/tmp0n00ou0m/tmpvn0ecs0n.py", line 13
print t[n]
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s425741375 | p02314 | u397460030 | 1456578555 | Python | Python3 | py | Runtime Error | 20 | 7656 | 276 | from itertools import product
value, variety = map(int, input().split())
coins = list(map(int, input().split()))
dp = [float("inf") for _ in range(value + 1)]
dp[0] = 0
for (c,j) in product(coins,list(range(value + 1))):
dp[j] = min(dp[j], dp[j - c] + 1)
print(dp[value]) | Traceback (most recent call last):
File "/tmp/tmpz9qh4etm/tmp1n_or7wj.py", line 3, in <module>
value, variety = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s452069029 | p02314 | u397460030 | 1456578592 | Python | Python3 | py | Runtime Error | 20 | 7672 | 276 | from itertools import product
value, variety = map(int, input().split())
coins = list(map(int, input().split()))
dp = [float("inf") for _ in range(value + 1)]
dp[0] = 0
for (c,j) in product(coins,list(range(value + 1))):
dp[j] = min(dp[j], dp[j - c] + 1)
print(dp[value]) | Traceback (most recent call last):
File "/tmp/tmp9qu5earp/tmpd665j6q4.py", line 3, in <module>
value, variety = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s579875572 | p02314 | u260980560 | 1465192176 | Python | Python | py | Runtime Error | 10 | 6472 | 352 | n, m = map(int, raw_input().split())
c = map(int, raw_input().split())
memo = [-1] * (n+1)
def dfs(rest):
if memo[rest] != -1:
return memo[rest]
if rest == 0:
return 0
res = n+1
for i in xrange(m):
if c[i] <= rest:
res = min(res, 1 + dfs(rest - c[i]))
memo[rest] = res
return res
print dfs(n) | File "/tmp/tmpc5r6or1p/tmpb6zznmh8.py", line 15
print dfs(n)
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s623528318 | p02314 | u408260374 | 1474512991 | Python | Python3 | py | Runtime Error | 50 | 8452 | 310 | import functools
@functools.lru_cache(maxsize=None)
def rec(c):
if c <= 0:
return 0 if c == 0 else INF
ret = INF
for coin in coins:
ret = min(ret, rec(c-coin) + 1)
return ret
INF = 10**6
N, M = map(int, input().split())
coins = [int(x) for x in input().split()]
print(rec(N)) | Traceback (most recent call last):
File "/tmp/tmpokv3c97s/tmpwpymacig.py", line 14, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s557705204 | p02314 | u408260374 | 1474513223 | Python | Python3 | py | Runtime Error | 0 | 0 | 353 | import functools, sys
@functools.lru_cache(maxsize=None)
def rec(c):
if c == 0:
return 0
ret = INF
for coin in coins:
if c - coin >= 0:
ret = min(ret, rec(c-coin) + 1)
return ret
INF = 10**6
N, M = map(int, input().split())
sys.setrecursionlimit(N+1)
coins = [int(x) for x in input().split()]
print(rec(N)) | Traceback (most recent call last):
File "/tmp/tmp_7si2ot3/tmptd0mjlfy.py", line 15, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s239794768 | p02314 | u408260374 | 1474513291 | Python | Python3 | py | Runtime Error | 80 | 44420 | 353 | import functools, sys
@functools.lru_cache(maxsize=None)
def rec(c):
if c == 0:
return 0
ret = INF
for coin in coins:
if c - coin >= 0:
ret = min(ret, rec(c-coin) + 1)
return ret
INF = 10**6
N, M = map(int, input().split())
coins = [int(x) for x in input().split()]
sys.setrecursionlimit(INF)
print(rec(N)) | Traceback (most recent call last):
File "/tmp/tmp6nq0aph9/tmp_boogcv8.py", line 15, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s150198023 | p02314 | u508732591 | 1482039337 | Python | Python3 | py | Runtime Error | 0 | 0 | 308 | n,m = map(int,input().split())
c = list(map(int,input().split()))
minimum = [50000] * (n+1)
minimum[0] = 0
for i in range(1,n+1):
if c[j] <= 2:
continue
for j in range(m):
if c[j]<=i and minimum[i-c[j]] + 1 < minimum[i]:
minimum[i] = minimum[i-c[j]]+1
print(minimum[n]) | Traceback (most recent call last):
File "/tmp/tmpa47os613/tmpsfdkh6un.py", line 1, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s631788682 | p02314 | u252368621 | 1482213143 | Python | Python3 | py | Runtime Error | 30 | 7744 | 520 | def dfs(index,n,m,c,dp):
if dp[index][m] != 30:
return dp[index][m]
if index==n:
return n+1
if m==c[index]:
return 1
if m<c[index]:
return dfs(index+1,n,m,c,dp)
ret=min(dfs(index+1,n,m,c,dp),
dfs(index+1,n,m-c[index],c,dp)+1,
dfs(index,n,m-c[index],c,dp)+1)
dp[index][m]=ret
return ret
m,n=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
dp=[[30 for i in range(m+1)] for j in range(n+1)]
print(dfs(0,n,m,c,dp)) | Traceback (most recent call last):
File "/tmp/tmpu2lhou24/tmp8pmdlt4e.py", line 19, in <module>
m,n=[int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s517835086 | p02314 | u865312527 | 1485109144 | Python | Python | py | Runtime Error | 0 | 0 | 257 | n, m = map(int, raw_input().split())
c = map(int, raw_input().split())
INF = 1000000000
t = [INF] * n
t[0] = 0
for i in range(m):
# print(c[i])
for j in range(c[i], n):
t[j] = min([t[j], t[j - c[i]] + 1])
# print(t)
print(t[n - 1])
~ | File "/tmp/tmpaw_a7iyv/tmplhlghy5_.py", line 16
~
^
SyntaxError: invalid syntax
| |
s149838726 | p02314 | u837811962 | 1497090571 | Python | Python3 | py | Runtime Error | 0 | 0 | 376 | currency = list(map(int,input().split()))
gra = [[0 for i in range(n+1)] for i in range(m)]
for i in range(m):
for j in range(1,n+1):
if i == 0:
gra[i][j] = j
else:
if j>=currency[i]:
gra[i][j] = min(gra[i-1][j],gra[i][j-currency[i]]+1)
else:
gra[i][j] = gra[i-1][j]
print(gra[m][n+1]) | Traceback (most recent call last):
File "/tmp/tmpcmsq3lyl/tmpevh1jfy7.py", line 1, in <module>
currency = list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s172576577 | p02314 | u837811962 | 1497090597 | Python | Python3 | py | Runtime Error | 0 | 0 | 376 | currency = list(map(int,input().split()))
gra = [[0 for i in range(n+1)] for i in range(m)]
for i in range(m):
for j in range(1,n+1):
if i == 0:
gra[i][j] = j
else:
if j>=currency[i]:
gra[i][j] = min(gra[i-1][j],gra[i][j-currency[i]]+1)
else:
gra[i][j] = gra[i-1][j]
print(gra[m][n+1]) | Traceback (most recent call last):
File "/tmp/tmpgbm08_3a/tmpkk67mzoy.py", line 1, in <module>
currency = list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s046861212 | p02314 | u837811962 | 1497152582 | Python | Python3 | py | Runtime Error | 0 | 0 | 376 | currency = list(map(int,input().split()))
gra = [[0 for i in range(n+1)] for i in range(m)]
for i in range(m):
for j in range(1,n+1):
if i == 0:
gra[i][j] = j
else:
if j>=currency[i]:
gra[i][j] = min(gra[i-1][j],gra[i][j-currency[i]]+1)
else:
gra[i][j] = gra[i-1][j]
print(gra[m-1][n]) | Traceback (most recent call last):
File "/tmp/tmpmc8zlvoe/tmp50svo6np.py", line 1, in <module>
currency = list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s916465570 | p02314 | u837811962 | 1497152620 | Python | Python3 | py | Runtime Error | 0 | 0 | 376 | currency = list(map(int,input().split()))
gra = [[0 for i in range(n+1)] for i in range(m)]
for i in range(m):
for j in range(1,n+1):
if i == 0:
gra[i][j] = j
else:
if j>=currency[i]:
gra[i][j] = min(gra[i-1][j],gra[i][j-currency[i]]+1)
else:
gra[i][j] = gra[i-1][j]
print(gra[m-1][n]) | Traceback (most recent call last):
File "/tmp/tmptwccxfp5/tmpvyi9wfog.py", line 1, in <module>
currency = list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s154448646 | p02314 | u837811962 | 1497154118 | Python | Python3 | py | Runtime Error | 0 | 0 | 376 | currency = list(map(int,input().split()))
gra = [[0 for i in range(n+1)] for i in range(m)]
for i in range(m):
for j in range(1,n+1):
if i == 0:
gra[i][j] = j
else:
if j>=currency[i]:
gra[i][j] = min(gra[i-1][j],gra[i][j-currency[i]]+1)
else:
gra[i][j] = gra[i-1][j]
print(gra[m-1][n]) | Traceback (most recent call last):
File "/tmp/tmpjtx5kcw6/tmpjf_n6r8i.py", line 1, in <module>
currency = list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s483230698 | p02314 | u216229195 | 1497246388 | Python | Python3 | py | Runtime Error | 4400 | 42556 | 855 | n, m = input().split()
n = int(n)
m = int(m)
c = []
c = input().split()
for i in range(0,m):
c[i] = int(c[i])
d = c[:]
c.reverse()
y = n
min = 0
while 1:
if len(d) == 0:
break
if y < max(d):
d.pop()
else:
min += int(y/max(d))
y = y % max(d)
d.pop()
#print(min)
memo = {}
#min = 100000000
depth = 0
def select(sum):
global min
global depth
done = []
if depth > min:
depth -= 1
return min
try:
if memo[depth,sum] > 0:
depth -= 1
return min
except KeyError:
pass
for i in c:
# if i in done:
# continue
sum += i
done.append(i)
# print(min, "/", sum, "/", depth, done)
if sum == n:
if depth + 1 < min:
min = depth + 1
sum -= i
elif sum > n:
sum -= i
continue
else:
depth += 1
sum -= i
min = select(sum+i)
memo[depth,sum] = min
depth -= 1
return min
select(0)
print(min) | Traceback (most recent call last):
File "/tmp/tmpjle36ef7/tmpl4cuutbw.py", line 1, in <module>
n, m = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s904078270 | p02314 | u216229195 | 1497246433 | Python | Python3 | py | Runtime Error | 4310 | 42768 | 862 | #coding: cp932
n, m = input().split()
n = int(n)
m = int(m)
c = []
c = input().split()
for i in range(0,m):
c[i] = int(c[i])
d = c[:]
c.reverse()
y = n
min = 0
while 1:
if len(d) == 0:
break
if y < max(d):
d.pop()
else:
min += int(y/max(d))
y = y % max(d)
d.pop()
#print(min)
memo = {}
#min = 100000000
depth = 0
def select(sum):
global min
global depth
done = []
if depth > min:
depth -= 1
return min
try:
if memo[depth,sum] > 0:
depth -= 1
return min
except:
pass
for i in c:
# if i in done:
# continue
sum += i
done.append(i)
# print(min, "/", sum, "/", depth, done)
if sum == n:
if depth + 1 < min:
min = depth + 1
sum -= i
elif sum > n:
sum -= i
continue
else:
depth += 1
sum -= i
min = select(sum+i)
memo[depth,sum] = min
depth -= 1
return min
select(0)
print(min) | Traceback (most recent call last):
File "/tmp/tmpdv30quem/tmpdsklmjwp.py", line 3, in <module>
n, m = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s395742337 | p02314 | u216229195 | 1497249172 | Python | Python3 | py | Runtime Error | 0 | 0 | 911 | #coding: cp932
n, m = input().split()
n = int(n)
m = int(m)
c = []
c = input().split()
for i in range(0,m):
c[i] = int(c[i])
d = c[:]
c.reverse()
y = n
min = 0
while 1:
if len(d) == 0:
break
if y < max(d):
d.pop()
else:
min += int(y/max(d))
y = y % max(d)
d.pop()
#print(min)
memo = []
for i in range(0,min+1):
memo.append(0)
#min = 100000000
depth = 0
def select(sum):
global n
global depth
global memo
global min
done = []
for i in c:
# ????????±???????§£????????????????????????????????????
if memo[depth] > 0:
return memo[depth]
# 1????????¶
if i in done:
continue
done.append(i)
# ???????????´????????????
sum += i
depth += 1
if sum == n:
memo[depth] = depth
min = depth
sum -= i
depth -= 1
elif sum > n:
sum -= i
depth -= 1
else:
min = select(sum)
sum -= i
depth -= 1
return min
min = select(0)
print(min) | Traceback (most recent call last):
File "/tmp/tmpky9uxp0m/tmp8q08to74.py", line 3, in <module>
n, m = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s985439435 | p02314 | u216229195 | 1497249198 | Python | Python3 | py | Runtime Error | 0 | 0 | 911 | #coding: cp932
n, m = input().split()
n = int(n)
m = int(m)
c = []
c = input().split()
for i in range(0,m):
c[i] = int(c[i])
d = c[:]
c.reverse()
y = n
min = 0
while 1:
if len(d) == 0:
break
if y < max(d):
d.pop()
else:
min += int(y/max(d))
y = y % max(d)
d.pop()
#print(min)
memo = []
for i in range(0,min+1):
memo.append(0)
#min = 100000000
depth = 0
def select(sum):
global n
global depth
global memo
global min
done = []
for i in c:
# ????????±???????§£????????????????????????????????????
if memo[depth] > 0:
return memo[depth]
# 1????????¶
if i in done:
continue
done.append(i)
# ???????????´????????????
sum += i
depth += 1
if sum == n:
memo[depth] = depth
min = depth
sum -= i
depth -= 1
elif sum > n:
sum -= i
depth -= 1
else:
min = select(sum)
sum -= i
depth -= 1
return min
min = select(0)
print(min) | Traceback (most recent call last):
File "/tmp/tmpvktx1q0k/tmpru_w5s4y.py", line 3, in <module>
n, m = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s868430048 | p02314 | u216229195 | 1497249226 | Python | Python3 | py | Runtime Error | 30 | 7740 | 787 | n, m = input().split()
n = int(n)
m = int(m)
c = []
c = input().split()
for i in range(0,m):
c[i] = int(c[i])
d = c[:]
c.reverse()
y = n
min = 0
while 1:
if len(d) == 0:
break
if y < max(d):
d.pop()
else:
min += int(y/max(d))
y = y % max(d)
d.pop()
#print(min)
memo = []
for i in range(0,min+1):
memo.append(0)
#min = 100000000
depth = 0
def select(sum):
global n
global depth
global memo
global min
done = []
for i in c:
if memo[depth] > 0:
return memo[depth]
if i in done:
continue
done.append(i)
sum += i
depth += 1
if sum == n:
memo[depth] = depth
min = depth
sum -= i
depth -= 1
elif sum > n:
sum -= i
depth -= 1
else:
min = select(sum)
sum -= i
depth -= 1
return min
min = select(0)
print(min) | Traceback (most recent call last):
File "/tmp/tmpfjlpp_fv/tmpqrrtjw3e.py", line 1, in <module>
n, m = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s632628037 | p02314 | u216229195 | 1497249252 | Python | Python3 | py | Runtime Error | 30 | 7728 | 787 | n, m = input().split()
n = int(n)
m = int(m)
c = []
c = input().split()
for i in range(0,m):
c[i] = int(c[i])
d = c[:]
c.reverse()
y = n
min = 0
while 1:
if len(d) == 0:
break
if y < max(d):
d.pop()
else:
min += int(y/max(d))
y = y % max(d)
d.pop()
#print(min)
memo = []
for i in range(0,min+1):
memo.append(0)
#min = 100000000
depth = 0
def select(sum):
global n
global depth
global memo
global min
done = []
for i in c:
if memo[depth] > 0:
return memo[depth]
if i in done:
continue
done.append(i)
sum += i
depth += 1
if sum == n:
memo[depth] = depth
min = depth
sum -= i
depth -= 1
elif sum > n:
sum -= i
depth -= 1
else:
min = select(sum)
sum -= i
depth -= 1
return min
min = select(0)
print(min) | Traceback (most recent call last):
File "/tmp/tmpvvhkgq7j/tmpzuf007t0.py", line 1, in <module>
n, m = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s260688170 | p02314 | u705768168 | 1513323688 | Python | Python | py | Runtime Error | 10 | 4688 | 426 | def calc_t(i,j):
global t,c
if i<0 or j<0:
return n+2
#print("get t["+str(i)+","+str(j)+"]")
if t[i][j]==n+1:
t[i][j]=min(calc_t(i-1,j),calc_t(i,j-c[i])+1)
return t[i][j]
ri=raw_input().split(" ")
n=int(ri[0])
m=int(ri[1])
ri=raw_input().split(" ")
c=[0]*m
t=[0]*m
for i in range(m):
c[i]=int(ri[i])
t[i]=[0]+[n+1]*n if i!=0 else range(n+1)
#print(c)
#print(t)
print(calc_t(m-1,n)) | Traceback (most recent call last):
File "/tmp/tmpqjpwgyyb/tmpgtd3l6gl.py", line 10, in <module>
ri=raw_input().split(" ")
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s277411856 | p02314 | u717102979 | 1515331728 | Python | Python3 | py | Runtime Error | 40 | 6800 | 801 | #! /usr/bin/env python3
'''
Author: krishna
Created: Sun Jan 7 12:52:35 2018 IST
File Name: minCoinChange.py
USAGE:
minCoinChange.py
Description:
'''
import sys, traceback, math
def solve(count, sol):
'''
Solve the problem ;)
'''
if not (count in sol):
s = math.inf
for i in range(1, (count + 1 >> 1) + 1):
# if (3 == len(traceback.extract_stack())):
# print(i, count - i, sol)
s = min(s, solve(i, sol) + solve(count - i, sol))
sol[count] = s
return sol[count]
def main():
''' The Main '''
n, m = map(int, sys.stdin.readline().split())
d = sorted(map(int, sys.stdin.readline().split()))
sol = {i: 1 for i in d}
print(solve(n, sol))
if __name__ == '__main__':
main()
| Traceback (most recent call last):
File "/tmp/tmpvdlk1hm4/tmp26dnuz1t.py", line 41, in <module>
main()
File "/tmp/tmpvdlk1hm4/tmp26dnuz1t.py", line 33, in main
n, m = map(int, sys.stdin.readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s244400190 | p02314 | u869924057 | 1518602695 | Python | Python3 | py | Runtime Error | 670 | 5620 | 955 | nm = input().split(' ')
n = int(nm[0])
m = int(nm[1])
c = list(map(int, input().split(' ')))
dp = {}
# cの要素のうちp番目以降を組み合わせてtを作れるか?作れるならその数を返す
def solve(p, t, num):
# 使う/使わないの枝をたどって0になったらOK
if (t == 0):
return (True, num)
# p, tが不正な値になればその枝は終了
if (p == m or t < 0):
return (False, num)
# p番目を使ったらtを引いて次へ, 使わなければtのまま次へ
ans1 = solve(p, t-c[p], num+1)
ans2 = (False, 50000)
ans3 = (False, 50000)
if (p < m):
ans2 = solve(p+1, t-c[p], num+1)
ans3 = solve(p+1, t, num)
# 最小のnumがansになる
ans = 50000
if (ans1[0] and ans1[1] < ans):
ans = ans1[1]
if (ans2[0] and ans2[1] < ans):
ans = ans2[1]
if (ans3[0] and ans3[1] < ans):
ans = ans3[1]
return (ans1[0] or ans2[0] or ans3[0], ans)
print(solve(0, n, 0)[1])
| Traceback (most recent call last):
File "/tmp/tmp70sehqcp/tmprwzk3lmt.py", line 1, in <module>
nm = input().split(' ')
^^^^^^^
EOFError: EOF when reading a line
| |
s892824438 | p02314 | u869924057 | 1518603071 | Python | Python3 | py | Runtime Error | 40 | 8092 | 1087 | import sys
sys.setrecursionlimit(50001)
nm = input().split(' ')
n = int(nm[0])
m = int(nm[1])
c = list(map(int, input().split(' ')))
dp = {}
# cの要素のうちp番目以降を組み合わせてtを作れるか?作れるならその数を返す
def solve(p, t, num):
if ((p, t, num) in dp):
return dp[(p, t, num)]
# 使う/使わないの枝をたどって0になったらOK
if (t == 0):
return (True, num)
# p, tが不正な値になればその枝は終了
if (p == m or t < 0):
return (False, num)
# p番目を使ったらtを引いて次へ, 使わなければtのまま次へ
ans1 = solve(p, t-c[p], num+1)
ans2 = (False, 50000)
ans3 = (False, 50000)
if (p < m):
ans2 = solve(p+1, t-c[p], num+1)
ans3 = solve(p+1, t, num)
# 最小のnumがansになる
ans = 50000
if (ans1[0] and ans1[1] < ans):
ans = ans1[1]
if (ans2[0] and ans2[1] < ans):
ans = ans2[1]
if (ans3[0] and ans3[1] < ans):
ans = ans3[1]
ret = (ans1[0] or ans2[0] or ans3[0], ans)
dp[(p, t, num)] = ret
return ret
print(solve(0, n, 0)[1])
| Traceback (most recent call last):
File "/tmp/tmpn9r9mv5w/tmpzv8nejn3.py", line 4, in <module>
nm = input().split(' ')
^^^^^^^
EOFError: EOF when reading a line
| |
s433171830 | p02314 | u869924057 | 1518692137 | Python | Python3 | py | Runtime Error | 0 | 0 | 1191 | nm = input().split(' ')
n = int(nm[0])
m = int(nm[1])
c = list(map(int, input().split(' ')))
dp = {}
# cの要素のうちp番目以降を組み合わせてtを作れるか?作れるならその数を返す
def solve(p, t):
if ((p, t) in dp):
return dp[(p, t)]
# 使う/使わないの枝をたどって0になったらOK
if (p == m):
return 0 if t == 0 else 50001
# p番目を1枚だけ使う
# p番目を使わずに次へ, 使ったらtから引いて結果に1を加えてもう一度
ans = min(solve(p+1, t), solve(p, t-c[p])+1)
dp[(p, t)] = ans
return ans
# ans.append(solve(p, t-c[p], num+1))
# ans.append(solve(p+1, t-c[p], num+1))
# ans.append(solve(p+1, t, num))
# p番目を0から使える枚数ギリギリまで使い次へ(再帰が深くなり過ぎるケースの対策)
# cnt = math.floor(t / c[p])
# for i in range(0, cnt+1):
# ans.append(solve(p+1, t-c[p]*i, num+i))
# 最小のnumがansになる
# ansNum = 50000
# for e in ans:
# if (e[0] and e[1] < ansNum):
# ansNum = e[1]
# ret = (list(map(lambda e: e[0], ans)).count(True) > 0, ansNum)
# dp[(p, t, num)] = ret
# return ret
print(solve(0, n))
| Traceback (most recent call last):
File "/tmp/tmpuqg8mn47/tmpaf45f6ka.py", line 1, in <module>
nm = input().split(' ')
^^^^^^^
EOFError: EOF when reading a line
| |
s300603222 | p02314 | u869924057 | 1518692163 | Python | Python3 | py | Runtime Error | 0 | 0 | 1232 | import sys
sys.setrecursionlimit(65532)
nm = input().split(' ')
n = int(nm[0])
m = int(nm[1])
c = list(map(int, input().split(' ')))
dp = {}
# cの要素のうちp番目以降を組み合わせてtを作れるか?作れるならその数を返す
def solve(p, t):
if ((p, t) in dp):
return dp[(p, t)]
# 使う/使わないの枝をたどって0になったらOK
if (p == m):
return 0 if t == 0 else 50001
# p番目を1枚だけ使う
# p番目を使わずに次へ, 使ったらtから引いて結果に1を加えてもう一度
ans = min(solve(p+1, t), solve(p, t-c[p])+1)
dp[(p, t)] = ans
return ans
# ans.append(solve(p, t-c[p], num+1))
# ans.append(solve(p+1, t-c[p], num+1))
# ans.append(solve(p+1, t, num))
# p番目を0から使える枚数ギリギリまで使い次へ(再帰が深くなり過ぎるケースの対策)
# cnt = math.floor(t / c[p])
# for i in range(0, cnt+1):
# ans.append(solve(p+1, t-c[p]*i, num+i))
# 最小のnumがansになる
# ansNum = 50000
# for e in ans:
# if (e[0] and e[1] < ansNum):
# ansNum = e[1]
# ret = (list(map(lambda e: e[0], ans)).count(True) > 0, ansNum)
# dp[(p, t, num)] = ret
# return ret
print(solve(0, n))
| Traceback (most recent call last):
File "/tmp/tmpmbqaaz5z/tmpzlehoc4r.py", line 4, in <module>
nm = input().split(' ')
^^^^^^^
EOFError: EOF when reading a line
| |
s575001044 | p02314 | u609484772 | 1525590790 | Python | Python3 | py | Runtime Error | 30 | 5656 | 468 | import math
n, m = map(int,input().split(' '))
d = list(map(int,input().split(' ')))
d.sort()
inf = n
dp = [ [ inf for i in range(m+1)] for j in range(n+1) ]
# dp
for j in range(m+1):
dp[0][j]=0
for j in range(m-1,-1,-1):
for i in range(n+1):
#for k in range(math.floor(i/d[j])+1):
k=1
r = k*d[j]
#print(i,j,k)
dp[i][j] = min( dp[i][j], dp[i][j+1], dp[i-r][j]+k )
#print("dp:",i,j,dp[i][j])
print(dp[n][0])
| Traceback (most recent call last):
File "/tmp/tmpj59ze7lc/tmpgyh4owip.py", line 2, in <module>
n, m = map(int,input().split(' '))
^^^^^^^
EOFError: EOF when reading a line
| |
s000023174 | p02314 | u255317651 | 1527322743 | Python | Python3 | py | Runtime Error | 750 | 7236 | 578 | # -*- coding: utf-8 -*-
"""
Created on Sat May 26 12:16:54 2018
DPL-1A Rec Call Revised
@author: maezawa
"""
n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
c.sort(reverse=True)
dp = [float('inf') for _ in range(n+1)]
dp[0] = 0
#print(n,m)
#print(c)
#print(*dp, sep='\n')
def min_number(nn):
if dp[nn] != float('inf'):
return dp[nn]
temp = []
for i in range(m):
if nn < c[i]:
continue
else:
temp.append(min_number(nn-c[i])+1)
dp[nn] = min(temp)
return dp[nn]
print(min_number(n))
| Traceback (most recent call last):
File "/tmp/tmpk40inpua/tmp17mv3pdi.py", line 8, in <module>
n, m = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s803724397 | p02314 | u255317651 | 1527323267 | Python | Python3 | py | Runtime Error | 770 | 7232 | 578 | # -*- coding: utf-8 -*-
"""
Created on Sat May 26 12:16:54 2018
DPL-1A Rec Call Revised
@author: maezawa
"""
n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
c.sort(reverse=True)
dp = [float('inf') for _ in range(n+1)]
dp[0] = 0
#print(n,m)
#print(c)
#print(*dp, sep='\n')
def min_number(nn):
if dp[nn] != float('inf'):
return dp[nn]
temp = []
for i in range(m):
if nn < c[i]:
continue
else:
temp.append(min_number(nn-c[i])+1)
dp[nn] = min(temp)
return dp[nn]
print(min_number(n))
| Traceback (most recent call last):
File "/tmp/tmp6f1917m5/tmpignl3ek2.py", line 8, in <module>
n, m = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s634815241 | p02314 | u467175809 | 1528470053 | Python | Python3 | py | Runtime Error | 20 | 5640 | 351 | #!/usr/bin/env python
n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
DP = {}
def func(num, yen):
if num < 0 or yen < 0:
return 10 ** 18
if num == 0 and yen == 0:
return 0
if not (num, yen) in DP:
DP[(num, yen)] = min(func(num - 1, yen), func(num, yen - c[num]) + 1)
return DP[(num, yen)]
print(func(m - 1, n))
| Traceback (most recent call last):
File "/tmp/tmplj_0sx8x/tmps6hh51p6.py", line 2, in <module>
n, m = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s006179358 | p02315 | u636240697 | 1531692437 | Python | Python3 | py | Runtime Error | 0 | 0 | 1091 | import numpy as np
n, W = map(int, input().split())
value = np.empty(110)
weight = np.empty(110)
dp = np.empty(110,10010)
for el in range(n):
value[el], weight[el] = map(int, input().split())
for w in range(W):
dp[0][w] = 0
for i in range(n):
for w in range(W + 1):
if w >= weight[i]:
#dp[i + 1][w]はi番目の品物の中から重さがwを超えないように選んだ時の、価値の総和の最大値
dp[i + 1][w] = max(dp[i][w - weight[i]] + value[i] , dp[i][w])
#その品物を選ぶか選ばないか判定する前のその重さの時の価値の最大値が既に分かっているので、判定するものの重量を差し引いた時の価値の最大値と判定しているものの価値を足し合わせて、
#判定する前のその時点(w)での元からある価値の最大値(dp[i][w]と比べている
#DP表には価値の最大値が書いてあり、組み合わせを記述するわけではない
else:
dp[i + 1][w] = dp[i][w]
print(dp[n][W])
| Traceback (most recent call last):
File "/tmp/tmpc9mxjkiw/tmpsoqyuo2l.py", line 3, in <module>
n, W = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s540744394 | p02315 | u636240697 | 1531693197 | Python | Python3 | py | Runtime Error | 0 | 0 | 1141 | import numpy as np
n, W = map(int, input().split())
value = np.empty(110, dtype = 'int8')
weight = np.empty(110, dtype = 'int8')
dp = np.empty((110,10010), dtype = 'int8')
for el in range(n):
value[el], weight[el] = map(int, input().split())
for w in range(W):
dp[0][w] = 0
for i in range(n):
for w in range(W + 1):
if w >= weight[i]:
#dp[i + 1][w]はi番目の品物の中から重さがwを超えないように選んだ時の、価値の総和の最大値
dp[i + 1][w] = max(dp[i][w - weight[i]] + value[i] , dp[i][w])
#その品物を選ぶか選ばないか判定する前のその重さの時の価値の最大値が既に分かっているので、判定するものの重量を差し引いた時の価値の最大値と判定しているものの価値を足し合わせて、
#判定する前のその時点(w)での元からある価値の最大値(dp[i][w]と比べている
#DP表には価値の最大値が書いてあり、組み合わせを記述するわけではない
else:
dp[i + 1][w] = dp[i][w]
print(dp[n][W])
| Traceback (most recent call last):
File "/tmp/tmp1lp38d7o/tmps69n9oa6.py", line 3, in <module>
n, W = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s988322270 | p02315 | u209989098 | 1531808650 | Python | Python3 | py | Runtime Error | 0 | 0 | 222 | N,W = map(int, input().split())
dp = [0]*(W+1)
for i in range(1,N+1):
v,w = map(int,input().split())
for j in range(w-1,, W, -1):
print(j)
x = v+dp[j-w]
if x > dp[j]: dp[j] = x
print(dp[W])
| File "/tmp/tmpmc_ltmrn/tmpcivmadmo.py", line 6
for j in range(w-1,, W, -1):
^
SyntaxError: invalid syntax
| |
s953713485 | p02315 | u209989098 | 1531808659 | Python | Python3 | py | Runtime Error | 0 | 0 | 221 | N,W = map(int, input().split())
dp = [0]*(W+1)
for i in range(1,N+1):
v,w = map(int,input().split())
for j in range(w-1, W, -1):
print(j)
x = v+dp[j-w]
if x > dp[j]: dp[j] = x
print(dp[W])
| File "/tmp/tmp7zvf57lv/tmpnomaiycp.py", line 8
x = v+dp[j-w]
TabError: inconsistent use of tabs and spaces in indentation
| |
s223341737 | p02315 | u209989098 | 1531809233 | Python | Python3 | py | Runtime Error | 0 | 0 | 209 | N , W = map(int,input())
dp[W+1] = [0]
for i in range(N):
n , m = map(input())
for j in range(W,m-1,-1):
x = n + dp[j-m]
if x > dp[j]:
dp[j] = x:
print(dp[W])
| File "/tmp/tmpf_f3zj4j/tmp8fidbqsw.py", line 9
dp[j] = x:
^
SyntaxError: invalid syntax
| |
s928847627 | p02315 | u209989098 | 1531809257 | Python | Python3 | py | Runtime Error | 0 | 0 | 229 | N , W = map(int,input().split())
dp[W+1] = [0]
for i in range(N):
n , m = map(int,input().split())
for j in range(W,m-1,-1):
x = n + dp[j-m]
if x > dp[j]:
dp[j] = x:
print(dp[W])
| File "/tmp/tmpjxm_1avz/tmpjoevf7ow.py", line 9
dp[j] = x:
^
SyntaxError: invalid syntax
| |
s668893879 | p02315 | u209989098 | 1531809272 | Python | Python3 | py | Runtime Error | 0 | 0 | 230 | N , W = map(int,input().split())
dp[W+1] = [0]
for i in range(N):
n , m = map(int,input().split())
for j in range(W,m-1,-1):
x = n + dp[j-m]
if x >= dp[j]:
dp[j] = x:
print(dp[W])
| File "/tmp/tmpkmvznh9s/tmpzf8b6lnl.py", line 9
dp[j] = x:
^
SyntaxError: invalid syntax
| |
s028594868 | p02315 | u209989098 | 1531809278 | Python | Python3 | py | Runtime Error | 0 | 0 | 229 | N , W = map(int,input().split())
dp[W+1] = [0]
for i in range(N):
n , m = map(int,input().split())
for j in range(W,m-1,-1):
x = n + dp[j-m]
if x >= dp[j]:
dp[j] = x
print(dp[W])
| Traceback (most recent call last):
File "/tmp/tmpegtodkj2/tmpto2dymb3.py", line 1, in <module>
N , W = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s993447268 | p02315 | u209989098 | 1531809301 | Python | Python3 | py | Runtime Error | 0 | 0 | 232 | N , W = map(int,input().split())
dp[] = [0]*(W+1)
for i in range(N):
n , m = map(int,input().split())
for j in range(W,m-1,-1):
x = n + dp[j-m]
if x >= dp[j]:
dp[j] = x
print(dp[W])
| File "/tmp/tmpemksfd9y/tmpzl59r4_7.py", line 2
dp[] = [0]*(W+1)
^
SyntaxError: invalid syntax
| |
s532614946 | p02315 | u704330856 | 1540731699 | Python | Python3 | py | Runtime Error | 470 | 24784 | 490 | N, W = (int(i) for i in input().split())
bagage = [[int(i) for i in input().split()] for _ in range(N)]
weight = []
value = []
for b in bagage:
value.append(b[0])
weight.append(b[1])
dp = [[0]*10010 for i in range(100)]
for j in range(W):
dp[N][j] = 0
for i in range(N-1, -1, -1):
for j in range(0, W+1, 1):
if j < weight[i]:
dp[i][j] = dp[i+1][j]
else:
dp[i][j] = max(dp[i+1][j], dp[i+1][j-weight[i]] + value[i])
print(dp[0][W])
| Traceback (most recent call last):
File "/tmp/tmpahhcnwyh/tmp3ve9p2pk.py", line 1, in <module>
N, W = (int(i) for i in input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s741716878 | p02315 | u025180675 | 1540875427 | Python | Python3 | py | Runtime Error | 0 | 0 | 513 | def ramp(t):
if t >= 0:
return t
else:
return 0
def heav(t):
if t >= 0:
return(1)
else:
return(0)
N,W = map(int,input().strip().split(" "))
lst = []
for i in range(N):
l = list(map(int,input().strip().split(" ")))
lst.append(l)
table = [[0 for c in range(W+1)] for i in range(N+1)]
for i in range(1,N+1):
for c in range(1,W+1):
table[i][c] = max(table[i-1][c],table[i-1][sgn(c-lst[i-1][1])]+lst[i-1][0]*heav(c-lst[i-1][1]))
print(table[N][W])
| Traceback (most recent call last):
File "/tmp/tmpnr1mf5hi/tmpy4cspian.py", line 12, in <module>
N,W = map(int,input().strip().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s878270134 | p02315 | u025180675 | 1540875671 | Python | Python3 | py | Runtime Error | 0 | 0 | 590 | #引数が非負ならそのまま、負なら0を返す
def ramp(t):
if t >= 0:
return t
else:
return 0
def heav(t):
if t >= 0:
return(1)
else:
return(0)
N,W = map(int,input().strip().split(" "))
lst = []
for i in range(N):
l = list(map(int,input().strip().split(" "))) #[v,w]の順で格納
lst.append(l)
table = [[0 for c in range(W+1)] for i in range(N+1)]
for i in range(1,N+1):
for c in range(1,W+1):
table[i][c] = max(table[i-1][c],table[i-1][sgn(c-lst[i-1][1])]+lst[i-1][0]*heav(c-lst[i-1][1]))
print(table[N][W])
| Traceback (most recent call last):
File "/tmp/tmpzlcdgp4t/tmpbm_eitcx.py", line 12, in <module>
N,W = map(int,input().strip().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s488881307 | p02315 | u692132831 | 1545206537 | Python | Python3 | py | Runtime Error | 0 | 0 | 552 | def weight(n, p, c):
global count
global m
if n % c[0] == 0:
count = min(count, p + n // c[0])
return count
elif p + n // c[0] >= count:
return n
elif c[0] < n:
return min(weight(n - c[0], p + 1, c), weight(n, p, c[1:]))
else:
return weight(n, p, c[1:])
N, W = map(int, input().split())
lisv = []
lisw = []
for i in range(n):
v, w = map(int, input().split())
lisv.append(v)
lisw.append(w)
for j in range(n):
pass
print(weight(N, 0, lisw))
#print(coin(n, 0, mon))
| Traceback (most recent call last):
File "/tmp/tmpbdtcz612/tmp2u9p5e6x.py", line 15, in <module>
N, W = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s705597338 | p02315 | u692132831 | 1545206557 | Python | Python3 | py | Runtime Error | 0 | 0 | 552 | def weight(n, p, c):
global count
global m
if n % c[0] == 0:
count = min(count, p + n // c[0])
return count
elif p + n // c[0] >= count:
return n
elif c[0] < n:
return min(weight(n - c[0], p + 1, c), weight(n, p, c[1:]))
else:
return weight(n, p, c[1:])
N, W = map(int, input().split())
lisv = []
lisw = []
for i in range(N):
v, w = map(int, input().split())
lisv.append(v)
lisw.append(w)
for j in range(N):
pass
print(weight(N, 0, lisw))
#print(coin(n, 0, mon))
| Traceback (most recent call last):
File "/tmp/tmpz_ziursu/tmpm8dilgnc.py", line 15, in <module>
N, W = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s126277137 | p02315 | u692132831 | 1545207545 | Python | Python3 | py | Runtime Error | 0 | 0 | 721 | def weight(n, p, c):
global count
global m
if n % c[0] == 0:
count = min(count, p + n // c[0])
return count
elif p + n // c[0] >= count:
return n
elif c[0] < n:
return min(weight(n - c[0], p + 1, c), weight(n, p, c[1:]))
else:
return weight(n, p, c[1:])
N, W = map(int, input().split())
lisv = []
lisw = []
for i in range(N):
v, w = map(int, input().split())
lisv.append(v)
lisw.append(w)
for j in range(N):
pass
count = N
print(weight(N, 0, lisw))
#print(coin(n, 0, mon))
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
| File "/tmp/tmpv8rfm1c1/tmp71d9liq8.py", line 31
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
^
SyntaxError: unterminated string literal (detected at line 31)
| |
s408928489 | p02315 | u692132831 | 1545207616 | Python | Python3 | py | Runtime Error | 0 | 0 | 610 | '''
def weight(n, p, c):
global count
global m
if n % c[0] == 0:
count = min(count, p + n // c[0])
return count
elif p + n // c[0] >= count:
return n
elif c[0] < n:
return min(weight(n - c[0], p + 1, c), weight(n, p, c[1:]))
else:
return weight(n, p, c[1:])
N, W = map(int, input().split())
lisv = []
lisw = []
for i in range(N):
v, w = map(int, input().split())
lisv.append(v)
lisw.append(w)
for j in range(N):
pass
count = N
print(weight(N, 0, lisw))
#print(coin(n, 0, mon))
'''
def x(x):
return(x(x))
print(x(1))
| Traceback (most recent call last):
File "/tmp/tmpzbz5xjzh/tmp1vakzaix.py", line 35, in <module>
print(x(1))
^^^^
File "/tmp/tmpzbz5xjzh/tmp1vakzaix.py", line 34, in x
return(x(x))
^^^^
TypeError: 'int' object is not callable
| |
s539630380 | p02315 | u692132831 | 1545207642 | Python | Python3 | py | Runtime Error | 0 | 0 | 612 | '''
def weight(n, p, c):
global count
global m
if n % c[0] == 0:
count = min(count, p + n // c[0])
return count
elif p + n // c[0] >= count:
return n
elif c[0] < n:
return min(weight(n - c[0], p + 1, c), weight(n, p, c[1:]))
else:
return weight(n, p, c[1:])
N, W = map(int, input().split())
lisv = []
lisw = []
for i in range(N):
v, w = map(int, input().split())
lisv.append(v)
lisw.append(w)
for j in range(N):
pass
count = N
print(weight(N, 0, lisw))
#print(coin(n, 0, mon))
'''
def x(x):
return(x(x))
print(x('1'))
| Traceback (most recent call last):
File "/tmp/tmpg3svg50y/tmpigfi33fn.py", line 35, in <module>
print(x('1'))
^^^^^^
File "/tmp/tmpg3svg50y/tmpigfi33fn.py", line 34, in x
return(x(x))
^^^^
TypeError: 'str' object is not callable
| |
s998849989 | p02315 | u692132831 | 1545207653 | Python | Python3 | py | Runtime Error | 0 | 0 | 613 | '''
def weight(n, p, c):
global count
global m
if n % c[0] == 0:
count = min(count, p + n // c[0])
return count
elif p + n // c[0] >= count:
return n
elif c[0] < n:
return min(weight(n - c[0], p + 1, c), weight(n, p, c[1:]))
else:
return weight(n, p, c[1:])
N, W = map(int, input().split())
lisv = []
lisw = []
for i in range(N):
v, w = map(int, input().split())
lisv.append(v)
lisw.append(w)
for j in range(N):
pass
count = N
print(weight(N, 0, lisw))
#print(coin(n, 0, mon))
'''
def x(x):
return(x(x))
print(x(None))
| Traceback (most recent call last):
File "/tmp/tmpn36y_299/tmpcngumtnv.py", line 35, in <module>
print(x(None))
^^^^^^^
File "/tmp/tmpn36y_299/tmpcngumtnv.py", line 34, in x
return(x(x))
^^^^
TypeError: 'NoneType' object is not callable
| |
s795354444 | p02315 | u692132831 | 1545207664 | Python | Python3 | py | Runtime Error | 0 | 0 | 610 | '''
def weight(n, p, c):
global count
global m
if n % c[0] == 0:
count = min(count, p + n // c[0])
return count
elif p + n // c[0] >= count:
return n
elif c[0] < n:
return min(weight(n - c[0], p + 1, c), weight(n, p, c[1:]))
else:
return weight(n, p, c[1:])
N, W = map(int, input().split())
lisv = []
lisw = []
for i in range(N):
v, w = map(int, input().split())
lisv.append(v)
lisw.append(w)
for j in range(N):
pass
count = N
print(weight(N, 0, lisw))
#print(coin(n, 0, mon))
'''
def x(x):
return(x(x))
print(x(x))
| Traceback (most recent call last):
File "/tmp/tmpki74c4n1/tmpjtazo0pz.py", line 35, in <module>
print(x(x))
^^^^
File "/tmp/tmpki74c4n1/tmpjtazo0pz.py", line 34, in x
return(x(x))
^^^^
File "/tmp/tmpki74c4n1/tmpjtazo0pz.py", line 34, in x
return(x(x))
^^^^
File "/tmp/tmpki74c4n1/tmpjtazo0pz.py", line 34, in x
return(x(x))
^^^^
[Previous line repeated 996 more times]
RecursionError: maximum recursion depth exceeded
| |
s996257486 | p02315 | u692132831 | 1545207699 | Python | Python3 | py | Runtime Error | 0 | 0 | 610 | '''
def weight(n, p, c):
global count
global m
if n % c[0] == 0:
count = min(count, p + n // c[0])
return count
elif p + n // c[0] >= count:
return n
elif c[0] < n:
return min(weight(n - c[0], p + 1, c), weight(n, p, c[1:]))
else:
return weight(n, p, c[1:])
N, W = map(int, input().split())
lisv = []
lisw = []
for i in range(N):
v, w = map(int, input().split())
lisv.append(v)
lisw.append(w)
for j in range(N):
pass
count = N
print(weight(N, 0, lisw))
#print(coin(n, 0, mon))
'''
def J(x):
return(J(x))
print(J(3))
| Traceback (most recent call last):
File "/tmp/tmppv0tvalm/tmph6banayo.py", line 35, in <module>
print(J(3))
^^^^
File "/tmp/tmppv0tvalm/tmph6banayo.py", line 34, in J
return(J(x))
^^^^
File "/tmp/tmppv0tvalm/tmph6banayo.py", line 34, in J
return(J(x))
^^^^
File "/tmp/tmppv0tvalm/tmph6banayo.py", line 34, in J
return(J(x))
^^^^
[Previous line repeated 996 more times]
RecursionError: maximum recursion depth exceeded
| |
s180083223 | p02315 | u692132831 | 1545208292 | Python | Python3 | py | Runtime Error | 0 | 0 | 248 | from sys import *
def ans()
W = int(input().split()[1])
C = [0] *-~ W
for e in stdin:
v,w=map(int,e.split())
for i in range(W, w-1, -1):
t = v + C[i - w]
if t > C[i]:
C[i] = t
print(C[W])
ans()
| File "/tmp/tmpbrubuvuh/tmp18ot4bxs.py", line 3
def ans()
^
SyntaxError: expected ':'
| |
s953895114 | p02315 | u114709303 | 1551412453 | Python | Python3 | py | Runtime Error | 0 | 0 | 477 | n, w = map(int, input().split())
values = [0]
weights = [0]
for i in range(n):
value, weight = map(int, input().split())
values.append(value)
weights.append(weight)
dp = [[0 for i in range(w + 1)] for j in range(len(values) + 1)]
for i in range(len(values)):
for j in range(w + 1):
if weights[i] <= j:
dp[i + 1][j] = max(dp[i][j - weights[i]] + values[i], dp[i][j])
else:
dp[i + 1][j] = dp[i][j]
print(dp[n][w + 1])
| Traceback (most recent call last):
File "/tmp/tmpq984z30u/tmp6vzu8yzn.py", line 1, in <module>
n, w = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s277858937 | p02315 | u114709303 | 1551422504 | Python | Python3 | py | Runtime Error | 0 | 0 | 477 | n, w = map(int, input().split())
values = [0]
weights = [0]
for i in range(n):
value, weight = map(int, input().split())
values.append(value)
weights.append(weight)
dp = [[0 for i in range(w + 1)] for j in range(len(values) + 1)]
for i in range(len(values)):
for j in range(w + 1):
if weights[i] <= j:
dp[i + 1][j] = max(dp[i][j - weights[i]] + values[i], dp[i][j])
else:
dp[i + 1][j] = dp[i][j]
print(dp[n][w + 1])
| Traceback (most recent call last):
File "/tmp/tmpbb2s19mh/tmpri7zi2k3.py", line 1, in <module>
n, w = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s549041449 | p02315 | u667315691 | 1556299615 | Python | Python3 | py | Runtime Error | 20 | 5708 | 528 | N,W=(int(x) for x in input().split())
t=0
weight=[0]*N
value=[0]*N
while t<N:
v,w=(int(x) for x in input().split())
value[t]=v
weight[t]=w
t=t+1
def kotae(N,W):
dp=[[0 for i in range(110)] for j in range(110)]
i=0
while i<N:
wei=0
while wei<W+1:
if wei>=weight[i]:
dp[i+1][wei]=max(dp[i][wei],dp[i][wei-weight[i]]+value[i])
else:
dp[i+1][wei]=dp[i][wei]
wei=wei+1
i=i+1
return dp[N][W]
print(kotae(N,W))
| Traceback (most recent call last):
File "/tmp/tmph5t_1wz5/tmptxib5gqr.py", line 1, in <module>
N,W=(int(x) for x in input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s526113318 | p02315 | u667315691 | 1556299702 | Python | Python3 | py | Runtime Error | 20 | 5708 | 528 | N,W=(int(x) for x in input().split())
t=0
weight=[0]*N
value=[0]*N
while t<N:
v,w=(int(x) for x in input().split())
value[t]=v
weight[t]=w
t=t+1
def kotae(N,W):
dp=[[0 for i in range(110)] for j in range(110)]
i=0
while i<N:
wei=0
while wei<W+1:
if wei>=weight[i]:
dp[i+1][wei]=max(dp[i][wei],dp[i][wei-weight[i]]+value[i])
else:
dp[i+1][wei]=dp[i][wei]
wei=wei+1
i=i+1
return dp[N][W]
print(kotae(N,W))
| Traceback (most recent call last):
File "/tmp/tmpvs10ngku/tmpz6rhg4r9.py", line 1, in <module>
N,W=(int(x) for x in input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s349014867 | p02315 | u399781630 | 1556404562 | Python | Python3 | py | Runtime Error | 0 | 0 | 602 |
def dp(i, j):
if dp_list[i][j] != -1:
return dp_list[i][j]
if i == len(lists):
return 0
if j < lists[i][1]:
dp_list[i][j] = dp(i + 1, j)
return dp_list[i][j]
else:
dp_list[i][j] = max(dp(i + 1, j), dp(i + 1, j - lists[i][1]) + lists[i][0])
return dp_list[i][j]
# N = 4
# W = 5
N, W = (int(x) for x in input().split())
# value, weightの順で並んでいる
lists = []
for i in N:
lists += list(lambda x: int(x), input().split())
dp_list = [[-1] * (W + 1)] * (N + 1)
# lists = [[4, 2], [5, 2], [2, 1], [8, 3]]
print(dp(0, W))
| Traceback (most recent call last):
File "/tmp/tmpdvavj1h9/tmpvzksarme.py", line 19, in <module>
N, W = (int(x) for x in input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s721124223 | p02315 | u182167513 | 1556702176 | Python | Python3 | py | Runtime Error | 0 | 0 | 833 | #Nはアイテム数、Wはナップサックサイズ
N,W = map(int,input().split())
#dpテーブルを作成(初期値は0)
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]
#print(dp)
#N個のアイテムのvalueとweightを入れるリストを用意する
value = []
weight = []
for i in range(N):
v,w = map(int,input().split())
value.append(v)
weight.append(w)
#print(values)
#print(weights)
#アイテムは1個目からN個まで、重さのレンジは0からWまで
for i in range(1,N+1):
for j in range(W+1):
if j >= weight[i-1]: #iは1から始めているので、weightやvalueのリストを参照するときは添字を1つ下げる
dp[i][j] = max(dp[i-1][j], value[i-1] + dp[i-1][j-weight[i-1]])
else:
dp[i][j] = dp[i-1][j]
print(dp[N+1][W+1])
| Traceback (most recent call last):
File "/tmp/tmpxh7_9qfg/tmp872lc3pg.py", line 2, in <module>
N,W = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s298094886 | p02315 | u210992699 | 1556871158 | Python | Python3 | py | Runtime Error | 0 | 0 | 389 | import numpy as np
N,W = map(int,input().split())
weight = [0]*N
value = [0]*N
dp = np.zeros((N+1,W+1))
for i in range(N):
value[i], weight[i] = map(int, input().split())
for i in range(N):
for j in range(W+1):
if j >= weight[i]:
dp[i+1][j] = max(dp[i][j-weight[i]]+value[i], dp[i][j])
else:
dp[i+1][j] = dp[i][j]
print(int(dp[N][W]))
| Traceback (most recent call last):
File "/tmp/tmp3m69eryi/tmpyqv4eve3.py", line 2, in <module>
N,W = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s491874698 | p02315 | u210992699 | 1556871337 | Python | Python3 | py | Runtime Error | 0 | 0 | 13 | import numpy
| ||
s145464814 | p02315 | u885631908 | 1443549719 | Python | Python3 | py | Runtime Error | 0 | 0 | 356 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
n,w = map(int,input().split())
v = [0] * (n+1)
w = [0] * (n+1)
for j in range(1, n+1):
v[j], w[j] = map(int,input().split())
dp = [[0 for i in range(w+1)] for j in range(n+1)]
for j in range(1, n+1):
for i in range(1, w+1):
dp[j][i] = max(dp[j-1][i], dp[j-1][i-w[j]] + v[i])
print(max(dp)) | Traceback (most recent call last):
File "/tmp/tmpayhs0knm/tmp7iu24n_z.py", line 3, in <module>
n,w = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s238065636 | p02315 | u488601719 | 1449906318 | Python | Python3 | py | Runtime Error | 0 | 0 | 328 | N, W = map(int, raw_input().split())
v = [0] * N
w = [0] * N
for i in range(N):
v[i], w[i] = map(int, raw_input().split())
def rec(i, j):
if i == N:
res = 0
elif j < w[i]:
res = rec(i + 1, j)
else:
res = max(rec(i + 1, j), rec(i + 1, j - w[i]) + v[i])
return res
print(rec(0, W)) | Traceback (most recent call last):
File "/tmp/tmpzvzhsbxp/tmpjn5aaoef.py", line 1, in <module>
N, W = map(int, raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s711452610 | p02315 | u494314211 | 1479020150 | Python | Python3 | py | Runtime Error | 0 | 0 | 270 | l=[]
while(item=input().split()):
l.append([item[1],item[0]])
# n=4
# l=[[2,3],[1,2],[3,4],[2,2]] #w,v
# W=5
def solve(i,w):
if i==n or w<0:
return(0)
elif w-l[i][0]<0:
return(0)
else:
return(max(solve(i+1,w),l[i][1]+solve(i+1,w-l[i][0])))
print(solve(0,W)) | File "/tmp/tmpfqcgawbb/tmpdo_d_mtg.py", line 2
while(item=input().split()):
^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s342108980 | p02315 | u494314211 | 1479020328 | Python | Python3 | py | Runtime Error | 0 | 0 | 328 | l=[]
N,W=list(map(int,(input().split())))
while(N):
item=list(map(int,input().split))
l.append([item[1],item[0]])
N-=1
# n=4
# l=[[2,3],[1,2],[3,4],[2,2]] #w,v
# W=5
def solve(i,w):
if i==n or w<0:
return(0)
elif w-l[i][0]<0:
return(0)
else:
return(max(solve(i+1,w),l[i][1]+solve(i+1,w-l[i][0])))
print(solve(0,W)) | Traceback (most recent call last):
File "/tmp/tmpmocvqyjy/tmpeb__ocl9.py", line 2, in <module>
N,W=list(map(int,(input().split())))
^^^^^^^
EOFError: EOF when reading a line
| |
s250122912 | p02315 | u494314211 | 1479020421 | Python | Python3 | py | Runtime Error | 0 | 0 | 337 | l=[]
N,W=list(map(int,(input().split())))
for i in range(N):
item=list(map(int,input().split))
l.append([item[1],item[0]])
N-=1
# n=4
# l=[[2,3],[1,2],[3,4],[2,2]] #w,v
# W=5
def solve(i,w):
if i==n or w<0:
return(0)
elif w-l[i][0]<0:
return(0)
else:
return(max(solve(i+1,w),l[i][1]+solve(i+1,w-l[i][0])))
print(solve(0,W)) | Traceback (most recent call last):
File "/tmp/tmp8hsr2_zg/tmp6lotd6aa.py", line 2, in <module>
N,W=list(map(int,(input().split())))
^^^^^^^
EOFError: EOF when reading a line
| |
s722282143 | p02315 | u494314211 | 1479020542 | Python | Python3 | py | Runtime Error | 0 | 0 | 330 | l=[]
N,W=list(map(int,input().split()))
for i in range(N):
item=list(map(int,input().split))
l.append([item[1],item[0]])
# n=4
# l=[[2,3],[1,2],[3,4],[2,2]] #w,v
# W=5
def solve(i,w):
if i==n or w<0:
return(0)
elif w-l[i][0]<0:
return(0)
else:
return(max(solve(i+1,w),l[i][1]+solve(i+1,w-l[i][0])))
print(solve(0,W)) | Traceback (most recent call last):
File "/tmp/tmpo_80sdkj/tmpw5q0crpd.py", line 2, in <module>
N,W=list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s854843321 | p02315 | u494314211 | 1479020582 | Python | Python3 | py | Runtime Error | 0 | 0 | 339 | l=[]
N,W=list(map(int,input().split()))
for i in range(N):
item=list(map(int,input().split))
l.append([item[1],item[0]])
# n=4
# l=[[2,3],[1,2],[3,4],[2,2]] #w,v
# W=5
print(l)
def solve(i,w):
if i==n or w<0:
return(0)
elif w-l[i][0]<0:
return(0)
else:
return(max(solve(i+1,w),l[i][1]+solve(i+1,w-l[i][0])))
print(solve(0,W)) | Traceback (most recent call last):
File "/tmp/tmpqcwr5w4n/tmpe9zf4d9j.py", line 2, in <module>
N,W=list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.