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
s306358039
p00202
u032662562
1519308235
Python
Python3
py
Runtime Error
0
0
2309
# -*- coding: utf-8 -*- import pdb import sys,math,time #Debug=True Debug=False nmax=1000000 #unit_cost = [500,305,260,129] #total_cost = 15000 #unit_cost = [12,9,5] #total_cost = 200909 unit_cost = [] total_cost=0 primes=[] pmax=-1 dic = {2:True,3:True} def prime3(n): global dic if n in dic: return(dic[n]) else: if n % 2==0: return False while True: for i in range(3,math.ceil(math.sqrt(n))+1,2): if n % i == 0: dic[n]=False return(False) dic[n]=True return(True) def cost_gen1(money, lvl=0, lst=[]): uc = unit_cost[lvl] if lvl==len(unit_cost)-1: yield uc * math.floor(money/uc) else: for i in range(int(money/uc),-1,-1): tot_uc = uc*i rem = money - tot_uc if rem < unit_cost[lvl+1]: yield tot_uc else: for j in cost_gen1(rem, lvl+1): yield j + tot_uc def check_mutually_prime(v): s = min(v) for i in range(2,s+1): if sum(map(lambda x:x%i, v))==0: return False return True def main(): global unit_cost, total_cost, primes, pmax if not Debug: fh=sys.stdin else: #fh=open('vol2_0202b.txt', 'r') fh=open('vol2_0202.txt', 'r') pdb.set_trace() while True: m, total_cost = list(map(int, fh.readline().strip().split())) if m==0 and total_cost==0: break v=[] for _ in range(m): v.append(int(fh.readline())) unit_cost = sorted(v, reverse=True) # 大きい順 # 互いに素(relative prime)、でないときの処理 if not check_mutually_prime(unit_cost): print('NA') continue t0=time.time() p=[] pmax=-1 gen=cost_gen1(total_cost, 0) for i in gen: #if i > pmax and i in primes: if i > pmax and prime3(i): p.append(i) pmax=max(p) if pmax==total_cost: break print(max(p)) if Debug: print('t=', time.time()-t0) fh.close() if __name__ == "__main__": main()
Traceback (most recent call last): File "/tmp/tmp04pzv134/tmpc5ytz2on.py", line 93, in <module> main() File "/tmp/tmp04pzv134/tmpc5ytz2on.py", line 64, in main m, total_cost = list(map(int, fh.readline().strip().split())) ^^^^^^^^^^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s371597075
p00202
u032662562
1519346154
Python
Python3
py
Runtime Error
0
0
2309
# -*- coding: utf-8 -*- import pdb import sys,math,time #Debug=True Debug=False nmax=1000000 #unit_cost = [500,305,260,129] #total_cost = 15000 #unit_cost = [12,9,5] #total_cost = 200909 unit_cost = [] total_cost=0 primes=[] pmax=-1 dic = {2:True,3:True} def prime3(n): global dic if n in dic: return(dic[n]) else: if n % 2==0: return False while True: for i in range(3,math.ceil(math.sqrt(n))+1,2): if n % i == 0: dic[n]=False return(False) dic[n]=True return(True) def cost_gen1(money, lvl=0, lst=[]): uc = unit_cost[lvl] if lvl==len(unit_cost)-1: yield uc * math.floor(money/uc) else: for i in range(int(money/uc),-1,-1): tot_uc = uc*i rem = money - tot_uc if rem < unit_cost[lvl+1]: yield tot_uc else: for j in cost_gen1(rem, lvl+1): yield j + tot_uc def check_mutually_prime(v): s = min(v) for i in range(2,s+1): if sum(map(lambda x:x%i, v))==0: return False return True def main(): global unit_cost, total_cost, primes, pmax if not Debug: fh=sys.stdin else: #fh=open('vol2_0202b.txt', 'r') fh=open('vol2_0202.txt', 'r') pdb.set_trace() while True: m, total_cost = list(map(int, fh.readline().strip().split())) if m==0 and total_cost==0: break v=[] for _ in range(m): v.append(int(fh.readline())) unit_cost = sorted(v, reverse=True) # 大きい順 # 互いに素(relative prime)、でないときの処理 if not check_mutually_prime(unit_cost): print('NA') continue t0=time.time() p=[] pmax=-1 gen=cost_gen1(total_cost, 0) for i in gen: #if i > pmax and i in primes: if i > pmax and prime3(i): p.append(i) pmax=max(p) if pmax==total_cost: break print(max(p)) if Debug: print('t=', time.time()-t0) fh.close() if __name__ == "__main__": main()
Traceback (most recent call last): File "/tmp/tmp8ghx356x/tmpppmp4ruf.py", line 93, in <module> main() File "/tmp/tmp8ghx356x/tmpppmp4ruf.py", line 64, in main m, total_cost = list(map(int, fh.readline().strip().split())) ^^^^^^^^^^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s221745652
p00202
u032662562
1519346343
Python
Python3
py
Runtime Error
0
0
2205
# -*- coding: utf-8 -*- import sys,math,time #Debug=True Debug=False nmax=1000000 unit_cost = [] total_cost=0 primes=[] pmax=-1 dic = {2:True,3:True} def prime3(n): global dic if n in dic: return(dic[n]) else: if n % 2==0: return False while True: for i in range(3,math.ceil(math.sqrt(n))+1,2): if n % i == 0: dic[n]=False return(False) dic[n]=True return(True) def cost_gen1(money, lvl=0, lst=[]): uc = unit_cost[lvl] if lvl==len(unit_cost)-1: yield uc * math.floor(money/uc) else: for i in range(int(money/uc),-1,-1): tot_uc = uc*i rem = money - tot_uc if rem < unit_cost[lvl+1]: yield tot_uc else: for j in cost_gen1(rem, lvl+1): yield j + tot_uc def check_mutually_prime(v): s = min(v) for i in range(2,s+1): if sum(map(lambda x:x%i, v))==0: return False return True def main(): global unit_cost, total_cost, primes, pmax if not Debug: fh=sys.stdin else: #fh=open('vol2_0202b.txt', 'r') fh=open('vol2_0202.txt', 'r') #pdb.set_trace() while True: m, total_cost = list(map(int, fh.readline().strip().split())) if m==0 and total_cost==0: break v=[] for _ in range(m): v.append(int(fh.readline())) unit_cost = sorted(v, reverse=True) # 大きい順 # 互いに素(relative prime)、でないときの処理 if not check_mutually_prime(unit_cost): print('NA') continue t0=time.time() p=[] pmax=-1 gen=cost_gen1(total_cost, 0) for i in gen: #if i > pmax and i in primes: if i > pmax and prime3(i): p.append(i) pmax=max(p) if pmax==total_cost: break print(max(p)) if Debug: print('t=', time.time()-t0) fh.close() if __name__ == "__main__": main()
Traceback (most recent call last): File "/tmp/tmp9_a62ic1/tmp38ngcsp2.py", line 88, in <module> main() File "/tmp/tmp9_a62ic1/tmp38ngcsp2.py", line 59, in main m, total_cost = list(map(int, fh.readline().strip().split())) ^^^^^^^^^^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s968471310
p00202
u032662562
1519346428
Python
Python3
py
Runtime Error
0
0
2203
# -*- coding: utf-8 -*- import sys,math #Debug=True Debug=False nmax=1000000 unit_cost = [] total_cost=0 primes=[] pmax=-1 dic = {2:True,3:True} def prime3(n): global dic if n in dic: return(dic[n]) else: if n % 2==0: return False while True: for i in range(3,math.ceil(math.sqrt(n))+1,2): if n % i == 0: dic[n]=False return(False) dic[n]=True return(True) def cost_gen1(money, lvl=0, lst=[]): uc = unit_cost[lvl] if lvl==len(unit_cost)-1: yield uc * math.floor(money/uc) else: for i in range(int(money/uc),-1,-1): tot_uc = uc*i rem = money - tot_uc if rem < unit_cost[lvl+1]: yield tot_uc else: for j in cost_gen1(rem, lvl+1): yield j + tot_uc def check_mutually_prime(v): s = min(v) for i in range(2,s+1): if sum(map(lambda x:x%i, v))==0: return False return True def main(): global unit_cost, total_cost, primes, pmax if not Debug: fh=sys.stdin else: #fh=open('vol2_0202b.txt', 'r') fh=open('vol2_0202.txt', 'r') #pdb.set_trace() while True: m, total_cost = list(map(int, fh.readline().strip().split())) if m==0 and total_cost==0: break v=[] for _ in range(m): v.append(int(fh.readline())) unit_cost = sorted(v, reverse=True) # 大きい順 # 互いに素(relative prime)、でないときの処理 if not check_mutually_prime(unit_cost): print('NA') continue #t0=time.time() p=[] pmax=-1 gen=cost_gen1(total_cost, 0) for i in gen: #if i > pmax and i in primes: if i > pmax and prime3(i): p.append(i) pmax=max(p) if pmax==total_cost: break print(max(p)) #if Debug: # print('t=', time.time()-t0) fh.close() if __name__ == "__main__": main()
Traceback (most recent call last): File "/tmp/tmpdq8ut8gs/tmp3ub0npr2.py", line 88, in <module> main() File "/tmp/tmpdq8ut8gs/tmp3ub0npr2.py", line 59, in main m, total_cost = list(map(int, fh.readline().strip().split())) ^^^^^^^^^^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s631716471
p00202
u032662562
1519483093
Python
Python3
py
Runtime Error
0
0
1347
# -*- coding: utf-8 -*- import sys from math import sqrt, ceil #Debug=True Debug=False nmax=1000000 nmax1=nmax+1 def nums(unit_cost, total_cost): cand = [True if i==0 else False for i in range(total_cost+1)] for i in range(total_cost+1): if cand[i]: for j in unit_cost: if i + j <= total_cost: cand[i+j]=True return(cand) dic = {2:True} def prime3(n): if n in dic: return(dic[n]) else: if n % 2==0: return False while True: for i in range(3,ceil(sqrt(n))+1,2): if n % i == 0: dic[n]=False return(False) dic[n]=True return(True) def main(): if Debug: fh=open('vol2_0202.txt', 'r') else: fh=sys.stdin while True: m, total_cost = list(map(int, fh.readline().strip().split())) if m==0: break v=[] for _ in range(m): v.append(int(fh.readline())) unit_cost = sorted(v) cand = nums(unit_cost, total_cost) for i in range(total_cost,-1,-1): if cand[i] and prime3(i): print(i) break if i==0: print("NA") fh.close() if __name__ == "__main__": main()
Traceback (most recent call last): File "/tmp/tmpx4rgt1jp/tmpaesgaojm.py", line 58, in <module> main() File "/tmp/tmpx4rgt1jp/tmpaesgaojm.py", line 39, in main m, total_cost = list(map(int, fh.readline().strip().split())) ^^^^^^^^^^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s705953996
p00202
u032662562
1519483988
Python
Python3
py
Runtime Error
0
0
1393
# -*- coding: utf-8 -*- import sys from math import sqrt, ceil #Debug=True Debug=False nmax=1000000 nmax1=nmax+1 def nums(unit_cost, total_cost): cand = [True if i==0 else False for i in range(total_cost+1)] for i in range(total_cost+1): if cand[i]: for j in unit_cost: if i + j <= total_cost: cand[i+j]=True return(cand) #dic = {2:True} def prime3(n): # if n in dic: # return(dic[n]) # else: if n % 2==0: return False while True: for i in range(3,ceil(sqrt(n))+1,2): if n % i == 0: #dic[n]=False return(False) #dic[n]=True return(True) def main(): if Debug: fh=open('vol2_0202.txt', 'r') else: fh=sys.stdin while True: m, total_cost = list(map(int, fh.readline().strip().split())) if m==0: break v=[] for _ in range(m): v.append(int(fh.readline())) unit_cost = sorted(v) cand = nums(unit_cost, total_cost) for i in range(total_cost,-1,-1): if cand[i] and prime3(i): print(i) break if i==0: print("NA") from time import sleep sleep(1) fh.close() if __name__ == "__main__": main()
Traceback (most recent call last): File "/tmp/tmp6_ac35u3/tmpomual9y4.py", line 60, in <module> main() File "/tmp/tmp6_ac35u3/tmpomual9y4.py", line 39, in main m, total_cost = list(map(int, fh.readline().strip().split())) ^^^^^^^^^^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s249066665
p00202
u032662562
1519546334
Python
Python
py
Runtime Error
0
0
1394
# -*- coding: utf-8 -*- import sys,time from math import sqrt, ceil range=xrange #Debug=True Debug=False nmax=1000000 nmax1=nmax+1 def nums(unit_cost, total_cost): cand = [True if i==0 else False for i in range(total_cost+1)] for i in range(total_cost+1): if cand[i]: for j in unit_cost: if i + j <= total_cost: cand[i+j]=True return(cand) #dic = {2:True} def prime3(n): # if n in dic: # return(dic[n]) # else: if n % 2==0: return False while True: for i in range(3,int(ceil(sqrt(n)))+1,2): if n % i == 0: #dic[n]=False return(False) #dic[n]=True return(True) def main(): if Debug: fh=open('vol2_0202.txt', 'r') else: fh=sys.stdin while True: m, total_cost = list(map(int, fh.readline().strip().split())) if m==0: break v=[] for _ in range(m): v.append(int(fh.readline())) unit_cost = sorted(v) cand = nums(unit_cost, total_cost) for i in range(total_cost,-1,-1): if cand[i] and prime3(i): print(i) break if i==0: print("NA") fh.close() if __name__ == "__main__": main() time.sleep(1)
Traceback (most recent call last): File "/tmp/tmp0tq56zwu/tmp4zh73a7g.py", line 4, in <module> range=xrange ^^^^^^ NameError: name 'xrange' is not defined. Did you mean: 'range'?
s194255898
p00202
u019169314
1528786819
Python
Python3
py
Runtime Error
0
0
629
N=1000000 isPrime = [False,False]+[True]*(N-2) isPrime[4::2] = [False]*len(isPrime[4::2]) for i in range(3,1000,2): if isPrime[i]: isPrime[2*i::i] = [False]*len(isPrime[2*i::i]) while True: n,g = [int(i) for i in input().split()] prices = [int(input()) for i in range(n)] if n==0: break isPayable = [True]+[False]*g for pri in prices: for i in range(0,g-pri): if isPayable[i]: isPayable[i+pri] = True for i in reversed(range(g+1)): if i == 0: print('NA') if isPrime[i] and isPayable[i]: print(i) break
Traceback (most recent call last): File "/tmp/tmpk2pa262d/tmpfqrlodz3.py", line 10, in <module> n,g = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s032774376
p00202
u019169314
1528787618
Python
Python3
py
Runtime Error
0
0
638
N=1000000 isPrime = [False,False]+[True]*(N-2) isPrime[4::2] = [False]*len(isPrime[4::2]) for i in range(3,1000,2): if isPrime[i]: isPrime[2*i::i] = [False]*len(isPrime[2*i::i]) while True: n,g = [int(i) for i in input().split()] prices = [int(input()) for i in range(n)] if n==0 and g==0: break isPayable = [True]+[False]*g for pri in prices: for i in range(0,g-pri): if isPayable[i]: isPayable[i+pri] = True for i in reversed(range(g+1)): if i == 0: print('NA') if isPrime[i] and isPayable[i]: print(i) break
Traceback (most recent call last): File "/tmp/tmpr0af1y1a/tmp_5d_rdto.py", line 10, in <module> n,g = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s231915136
p00202
u019169314
1528803873
Python
Python3
py
Runtime Error
0
0
640
N=1000000 isPrime = [False,False]+[True]*(N-2) isPrime[4::2] = [False]*len(isPrime[4::2]) for i in range(3,1000,2): if isPrime[i]: isPrime[2*i::i] = [False]*len(isPrime[2*i::i]) while True: n,g = [int(i) for i in input().split()] prices = [int(input()) for i in range(n)] if n==0 and g == 0: break isPayable = [True]+[False]*g for pri in prices: for i in range(0,g-pri): if isPayable[i]: isPayable[i+pri] = True for i in reversed(range(g+1)): if i == 0: print('NA') if isPrime[i] and isPayable[i]: print(i) break
Traceback (most recent call last): File "/tmp/tmpf0tda_nj/tmpyn3k3_nw.py", line 10, in <module> n,g = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s402161807
p00202
u019169314
1528808071
Python
Python3
py
Runtime Error
0
0
565
isPrime = [False,False]+[True]*(1000000-2) isPrime[4::2] = [False]*len(isPrime[4::2]) for i in range(3,1000,2): if isPrime[i]: isPrime[2*i::i] = [False]*len(isPrime[2*i::i]) while True: n,x = [int(i) for i in input().split()] if n==0: break prices = [int(input()) for i in range(n)] isPayable = [True]+[False]*x for pri in prices: for i in range(0,x-pri): if isPayable[i]: isPayable[i+pri] = True li = [i for i in range(x+1) if isPayable[i] and isPrime[i]] print(max(li) if li else 'NA')
Traceback (most recent call last): File "/tmp/tmpjf2n1qjq/tmp0pf6mf4h.py", line 8, in <module> n,x = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s912524687
p00202
u019169314
1528808330
Python
Python3
py
Runtime Error
0
0
567
isPrime = [False,False]+[True]*(1000000-2) isPrime[4::2] = [False]*len(isPrime[4::2]) for i in range(3,1000,2): if isPrime[i]: isPrime[2*i::i] = [False]*len(isPrime[2*i::i]) while True: n,x = [int(i) for i in input().split()] if n==0: break prices = [int(input()) for i in range(n)] isPayable = [True]+[False]*x for pri in prices: for i in range(0,x-pri+1): if isPayable[i]: isPayable[i+pri] = True li = [i for i in range(x+1) if isPayable[i] and isPrime[i]] print(max(li) if li else 'NA')
Traceback (most recent call last): File "/tmp/tmp19jlri3d/tmp0g6c9f1e.py", line 8, in <module> n,x = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s496475884
p00202
u019169314
1528866506
Python
Python3
py
Runtime Error
0
0
567
isPrime = [False,False]+[True]*(1000000-2) isPrime[4::2] = [False]*len(isPrime[4::2]) for i in range(3,1000,2): if isPrime[i]: isPrime[2*i::i] = [False]*len(isPrime[2*i::i]) while True: n,x = [int(i) for i in input().split()] if n==0: break prices = [int(input()) for i in range(n)] isPayable = [True]+[False]*x for pri in prices: for i in range(0,x-pri+1): if isPayable[i]: isPayable[i+pri] = True li = [i for i in range(x+1) if isPayable[i] and isPrime[i]] print(max(li) if li else 'NA')
Traceback (most recent call last): File "/tmp/tmpysr344s3/tmpbo12w6nh.py", line 8, in <module> n,x = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s142626256
p00202
u019169314
1528866979
Python
Python3
py
Runtime Error
0
0
604
while True: n,x = [int(i) for i in input().split()] if n==0: break prices = [int(input()) for i in range(n)] isPrime = [False,False]+[True]*(x-1) # x+1 isPrime[4::2] = [False]*len(isPrime[4::2]) for i in range(3,int(x**0.5)+1,2): if isPrime[i]: isPrime[2*i::i] = [False]*len(isPrime[2*i::i]) isPayable = [True]+[False]*x # x+1 for pri in prices: for i in range(0,x-pri+1): if isPayable[i]: isPayable[i+pri] = True li = [i for i in range(x+1) if isPayable[i] and isPrime[i]] print(max(li) if li else 'NA')
Traceback (most recent call last): File "/tmp/tmp0x3acj9a/tmp5hb_lr44.py", line 2, in <module> n,x = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s365962816
p00202
u019169314
1528867316
Python
Python3
py
Runtime Error
0
0
592
isPrime = [False,False]+[True]*(1000000) isPrime[4::2] = [False]*len(isPrime[4::2]) for i in range(3,1000,2): if isPrime[i]: isPrime[2*i::i] = [False]*len(isPrime[2*i::i]) while True: n,x = [int(i) for i in input().split()] if n==0: break prices = [int(input()) for i in range(n)] isPayable = [False]*(x+1) for pri in prices: isPayable[pri] = True for i in range(0,x-pri+1): if isPayable[i]: isPayable[i+pri] = True li = [i for i in range(x+1) if isPayable[i] and isPrime[i]] print(max(li) if li else 'NA')
Traceback (most recent call last): File "/tmp/tmpjo79_4e2/tmpjpg8rjjm.py", line 8, in <module> n,x = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s203432247
p00202
u019169314
1528867565
Python
Python3
py
Runtime Error
0
0
650
isPrime = [False,False]+[True]*(1000000) isPrime[4::2] = [False]*len(isPrime[4::2]) for i in range(3,1000,2): if isPrime[i]: isPrime[2*i::i] = [False]*len(isPrime[2*i::i]) while True: n,x = [int(i) for i in input().split()] if n==0: break prices = [int(input()) for i in range(n)] isPayable = [False]*(x+1) for pri in prices: isPayable[pri] = True for i in range(0,x-pri+1): if isPayable[i]: isPayable[i+pri] = True for i in reversed(range(x+1)): if isPayable[i] and isPrime[i]: print(i) break if i == 0: print('NA')
Traceback (most recent call last): File "/tmp/tmpxcu5ivb1/tmp7lbe0ac2.py", line 8, in <module> n,x = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s369252890
p00202
u019169314
1528869173
Python
Python3
py
Runtime Error
0
0
745
isPrime = [False,False]+[True]*(1000000-1) # 1,000,001 isPrime[4::2] = [False]*len(isPrime[4::2]) for i in range(3,1000,2): if isPrime[i]: isPrime[2*i::i] = [False]*len(isPrime[2*i::i]) while True: # n,x = [int(i) for i in input().split()] n,x = list(map(int, input().split())) if n==0 and x==0: break prices = [int(input()) for i in range(n)] # n isPayable = [False]*(x+1) # x+1 for pri in prices: isPayable[pri] = True for i in range(0,x-pri+1): if isPayable[i]: isPayable[i+pri] = True for i in reversed(range(x+1)): if isPayable[i] and isPrime[i]: print(i) break if i == 0: print('NA') break
Traceback (most recent call last): File "/tmp/tmpjtu5v_22/tmpjc6n_mf4.py", line 9, in <module> n,x = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s768152922
p00202
u019169314
1528870227
Python
Python3
py
Runtime Error
0
0
522
isPrime = [False, True] * 500000 isPrime[1:3] = [False, True] for i in range(3, 1000, 2): if isPrime[i]: isPrime[2 * i::i] = [False] * len(isPrime[2 * i::i]) while True: n, x = [int(i) for i in input().split()] if n == 0: break prices = [int(input()) for i in range(n)] # n isPayable = [True] + [False] * x # x+1 for pri in prices: for i in range(0, x - pri + 1): if isPayable[i]: isPayable[i + pri] = True li = [i for i in range(x + 1) if isPayable[i] and isPrime[i]] print(max(li) if li else 'NA')
Traceback (most recent call last): File "/tmp/tmpl0oohuln/tmplp8r6goe.py", line 8, in <module> n, x = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s339638918
p00202
u019169314
1528875694
Python
Python3
py
Runtime Error
0
0
609
isPrime = [False,True]*500000 # len:1,000,000 isPrime[1:3] = [False,True] for i in range(3,1000,2): if isPrime[i]: isPrime[i*i::2*i] = [False]*len(isPrime[i*i::2*i]) n,x = map(int, input().split()) while n!=0: prices = [int(input()) for i in range(n)] # len:n isPayable = [False]*(x+1) # len:x+1 for pri in prices: isPayable[pri] = True for i in range(0,x-pri+1): if isPayable[i]: isPayable[i+pri] = True li = [i for i in range(x+1) if isPayable[i] and isPrime[i]] print(max(li) if li else 'NA') n,x = map(int, input().split())
Traceback (most recent call last): File "/tmp/tmp7qlf5m4r/tmpfdnjfsan.py", line 7, in <module> n,x = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s438098432
p00202
u019169314
1528876514
Python
Python3
py
Runtime Error
0
0
683
isPrime = [False,True]*500000 # len:1,000,000 isPrime[1:3] = [False,True] for i in range(3,1000,2): if isPrime[i]: isPrime[i*i::2*i] = [False]*len(isPrime[i*i::2*i]) while True: # n,x = [int(i) for i in input().split()] n,x = map(int, input().split()) if n==0 and x==0: import sys sys.exit() prices = [int(input()) for i in range(n)] # len:n isPayable = [False]*(x+1) # len:x+1 for pri in prices: isPayable[pri] = True for i in range(0,x-pri+1): if isPayable[i]: isPayable[i+pri] = True li = [i for i in range(x+1) if isPayable[i] and isPrime[i]] print(max(li) if li else 'NA')
Traceback (most recent call last): File "/tmp/tmp5lot5tmv/tmpw7vn9may.py", line 9, in <module> n,x = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s900595874
p00202
u019169314
1528876760
Python
Python3
py
Runtime Error
0
0
618
isPrime = [False,True]*500000 + [True] # len:1,000,000 isPrime[1:3] = [False,True] for i in range(3,1000,2): if isPrime[i]: isPrime[i*i::2*i] = [False]*len(isPrime[i*i::2*i]) n,x = map(int, input().split()) while n!=0: prices = [int(input()) for i in range(n)] # len:n isPayable = [False]*(x+1) # len:x+1 for pri in prices: isPayable[pri] = True for i in range(0,x-pri+1): if isPayable[i]: isPayable[i+pri] = True li = [i for i in range(x+1) if isPayable[i] and isPrime[i]] print(max(li) if li else 'NA') n,x = map(int, input().split())
Traceback (most recent call last): File "/tmp/tmpwkr73c68/tmpf9cmineh.py", line 7, in <module> n,x = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s158627737
p00202
u019169314
1528877397
Python
Python3
py
Runtime Error
0
0
626
isPrime = [False,True]*500000+[False] # len:1,000,001 isPrime[1:3] = [False,True] for i in range(3,1000,2): if isPrime[i]: isPrime[i*i::2*i] = [False]*len(isPrime[i*i::2*i]) while True: n,x = map(int, input().split()) if n==0 and x==0: break prices = [int(input()) for i in range(n)] # len:n isPayable = [False]*(x+1) # len:x+1 for pri in prices: isPayable[pri] = True for i in range(0,x-pri+1): if isPayable[i]: isPayable[i+pri] = True li = [i for i in range(x+1) if isPayable[i] and isPrime[i]] print(str(max(li)) if li else 'NA')
Traceback (most recent call last): File "/tmp/tmpzfjc03ke/tmpd387pw1s.py", line 8, in <module> n,x = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s187125762
p00202
u847467233
1529982975
Python
Python3
py
Runtime Error
0
0
666
# AOJ 0202: At Boss's Expense # Python3 2018.6.26 bal4u MAX = 1000000 SQRT = 1000 # sqrt(MAX) not_prime = [0]*MAX def sieve(): for i in range(3, SQRT, 2): if not_prime[i] == 0: for j in range(i*i, MAX, i): not_prime[j] = 1 sieve() while True: n, x = map(int, input().split()) if n == 0: break mk, v = [0]*(x+1), [0]*n for i in range(n): v[i] = int(input()) mk[0] = 1 for k in range(x): if mk[k]: for i in range(n): if k+v[i] <= x: mk[k+v[i]] = 1 ans = -1 if x <= 2: if mk[x]: ans = x else: if (x & 1) == 0: x -= 1 while x > 0: if mk[x] and not_prime[x] == 0: ans = x break x -= 2 print(ans if ans >= 0 else "NA")
Traceback (most recent call last): File "/tmp/tmpexw4fs_y/tmpy8w1zoxs.py", line 15, in <module> n, x = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s807785750
p00202
u847467233
1529983568
Python
Python3
py
Runtime Error
0
0
671
# AOJ 0202: At Boss's Expense # Python3 2018.6.26 bal4u MAX = 1000000 SQRT = 1000 # sqrt(MAX) not_prime = [0]*(MAX+3) def sieve(): for i in range(3, SQRT, 2): if not_prime[i] == 0: for j in range(i*i, MAX, i): not_prime[j] = 1 sieve() while True: n, x = map(int, input().split()) if n == 0: break mk, v = [0]*(x+1), [0]*n for i in range(n): v[i] = int(input()) mk[0] = 1 for k in range(x): if mk[k]: for i in range(n): if k+v[i] <= x: mk[k+v[i]] = 1 ans = -1 if x <= 2: if mk[x]: ans = x else: if (x & 1) == 0: x -= 1 while x > 0: if mk[x] and not_prime[x] == 0: ans = x break x -= 2 print(ans if ans >= 0 else "NA")
Traceback (most recent call last): File "/tmp/tmp4n4ebliy/tmpvgqsbq_h.py", line 16, in <module> n, x = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s550939980
p00202
u847467233
1530014582
Python
Python3
py
Runtime Error
0
0
670
# AOJ 0202: At Boss's Expense # Python3 2018.6.26 bal4u MAX = 1000000 SQRT = 1000 # sqrt(MAX) not_prime = [0]*(MAX+3) def sieve(): for i in range(3, SQRT, 2): if not_prime[i] == 0: for j in range(i*i, MAX, i): not_prime[j] = 1 sieve() v = [0]*33 while True: n, x = map(int, input().split()) if n == 0: break mk = [0]*(x+3) for i in range(n): v[i] = int(input()) mk[0] = 1 for k in range(x): if mk[k]: for i in range(n): if k+v[i] <= x: mk[k+v[i]] = 1 ans = -1 if x <= 2: if mk[x]: ans = x else: if (x & 1) == 0: x -= 1 while x > 0: if mk[x] and not_prime[x] == 0: ans = x break x -= 2 print(ans if ans >= 0 else "NA")
Traceback (most recent call last): File "/tmp/tmp7wv6ippm/tmp7n3lol9r.py", line 16, in <module> n, x = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s232660345
p00202
u759949288
1361350723
Python
Python
py
Runtime Error
19920
122852
573
from array import array PRIME_MAX = 1000001 isPrime = array('b', [True] * PRIME_MAX) isPrime[0] = isPrime[1] = False for i in xrange(2, PRIME_MAX): if not isPrime[i]: continue for j in xrange(i << 1, PRIME_MAX, i): isPrime[j] = False while True: n, x = map(int, raw_input().split()) if n == x == 0: break menu = [input() for i in xrange(n)] result = 0 exists = set() exists.add(0) for i in xrange(x + 1): if i in exists: exists.remove(i) for v in menu: exists.add(i + v) if isPrime[i]: result = i if result: print result else: print "NA"
File "/tmp/tmpphv9ao8v/tmphm40rtgc.py", line 24 print result ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s010379489
p00202
u759949288
1361351416
Python
Python
py
Runtime Error
19930
122856
564
from array import array PRIME_MAX = 1000001 isPrime = array('b', [1] * PRIME_MAX) isPrime[0] = 0 isPrime[1] = 0 for i in xrange(2, PRIME_MAX): if not isPrime[i]: continue for j in xrange(i << 1, PRIME_MAX, i): isPrime[j] = 0 while True: n, x = map(int, raw_input().split()) if n == x == 0: break menu = [input() for i in xrange(n)] result = 0 exists = set() exists.add(0) for i in xrange(x + 1): if i in exists: exists.remove(i) for v in menu: exists.add(i + v) if isPrime[i]: result = i if result: print result else: print "NA"
File "/tmp/tmpka9szczt/tmpjfkzmobm.py", line 25 print result ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s674687800
p00202
u759949288
1361361808
Python
Python
py
Runtime Error
19920
123148
642
import sys from array import array PRIME_MAX = 1000001 isPrime = array('b', [True] * PRIME_MAX) isPrime[0] = isPrime[1] = False for i in xrange(2, PRIME_MAX): if not isPrime[i]: continue for j in xrange(i << 1, PRIME_MAX, i): isPrime[j] = False sin = iter(map(int, "".join(sys.stdin.readlines()).split())) while True: n = sin.next() x = sin.next() if n == x == 0: break menu = [sin.next() for i in xrange(n)] result = 0 exists = set() exists.add(0) for i in xrange(x + 1): if i in exists: exists.remove(i) for v in menu: exists.add(i + v) if isPrime[i]: result = i if result: print result else: print "NA"
File "/tmp/tmpfl4ictej/tmpoko6ioe0.py", line 27 print result ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s522691893
p00202
u759949288
1361362674
Python
Python
py
Runtime Error
19930
122920
643
import sys from array import array PRIME_MAX = 1000010 isPrime = array('b', [True] * PRIME_MAX) isPrime[0] = isPrime[1] = False for i in xrange(2, PRIME_MAX): if not isPrime[i]: continue for j in xrange(i << 1, PRIME_MAX, i): isPrime[j] = False sin = iter(map(int, "".join(sys.stdin.readlines()).split())) while True: n = sin.next() x = sin.next() if n == x == 0: break menu = [sin.next() for i in xrange(n)] result = 0 exists = set() exists.add(0) for i in xrange(x + 1): if i in exists: exists.discard(i) for v in menu: exists.add(i + v) if isPrime[i]: result = i if result: print result else: print "NA"
File "/tmp/tmpg08zihv3/tmpaaofckm1.py", line 27 print result ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s339708946
p00202
u759949288
1361363171
Python
Python
py
Runtime Error
19930
35560
606
import sys PRIME_MAX = 1000010 isPrime = [True] * PRIME_MAX isPrime[0] = isPrime[1] = False for i in xrange(2, PRIME_MAX): if not isPrime[i]: continue for j in xrange(i << 1, PRIME_MAX, i): isPrime[j] = False sin = iter(map(int, "".join(sys.stdin.readlines()).split())) while True: n = sin.next() x = sin.next() if n == x == 0: break menu = [sin.next() for i in xrange(n)] result = 0 dp = [False] * (x + 1) dp[0] = True for i in xrange(x + 1): if dp[i]: for v in menu: if i + v <= x: dp[i + v] = True if isPrime[i]: result = i if result: print result else: print "NA"
File "/tmp/tmp7j1oamju/tmp1e3flvmj.py", line 26 print result ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s116228937
p00202
u633068244
1396445778
Python
Python
py
Runtime Error
0
0
363
def prime(n): return True if pow(2,n-1,n)==1 else False while 1: n,x=map(int,raw_input().split()) if n==0:break p=[input() for i in [1]*n] s=[0 for i in [1]*(x+1)] for i in p:s[i]=1 for i in range(1,x+1): if s[i]==1: for j in p: try:s[i+j]=1 except:pass for i in range(x,0,-1): if s[i]==1 and prime(i): print i break else:print "NA"
File "/tmp/tmpp_7o0k92/tmp_xhf4sok.py", line 17 print i ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s299345573
p00202
u633068244
1396445812
Python
Python
py
Runtime Error
0
0
412
def prime(n): return True if pow(2,n-1,n)==1 else False while 1: try: n,x=map(int,raw_input().split()) if n==0:break p=[input() for i in [1]*n] s=[0 for i in [1]*(x+1)] for i in p:s[i]=1 for i in range(1,x+1): if s[i]==1: for j in p: try:s[i+j]=1 except:pass for i in range(x,0,-1): if s[i]==1 and prime(i): print i break else:print "NA" except SyntaxError: pass
File "/tmp/tmpvelzfkx7/tmpdqpr4n1v.py", line 18 print i ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s177246307
p00202
u871901071
1397311056
Python
Python
py
Runtime Error
0
0
1210
input = raw_input def init(): table = [True] * 1000001 table[0] = False table[1] = False n = len(table) for i in range(2, n): for j in range(i + i, n, i): table[j] = False return table def is_prime(p): if p == 0 or p == 1: return False for i in range(2, p - 1): if p % i == 0: return False return True def solve(price, ps, is_prime): dp = [] for i in range(len(ps)): dp.append([False] * (price + 1)) dp[0][ps[0]] = True dp[0][0] = True for i in range(1, len(ps)): for p in range(price + 1): if p >= ps[i]: dp[i][p] = dp[i - 1][p] or dp[i][p - ps[i]] else: dp[i][p] = dp[i - 1][p] p = -1 for i in range(0, price + 1): if is_prime[i] and dp[len(ps) - 1][i]: p = i if p == -1: print("NA") else: print(p) def main(): table = init() while True: n, price = map(int,input().split()) if n == 0 and price == 0: return ps = [] for i in range(n): ps.append(int(input())) solve(price, ps, table) main()
Traceback (most recent call last): File "/tmp/tmpc4t0nkf9/tmpo4awxptt.py", line 1, in <module> input = raw_input ^^^^^^^^^ NameError: name 'raw_input' is not defined
s011062807
p00202
u871901071
1397311146
Python
Python
py
Runtime Error
0
0
1199
def init(): table = [True] * 1000001 table[0] = False table[1] = False n = len(table) for i in range(2, n): for j in range(i + i, n, i): table[j] = False return table def is_prime(p): if p == 0 or p == 1: return False for i in range(2, p - 1): if p % i == 0: return False return True def solve(price, ps, is_prime): dp = [] for i in range(len(ps)): dp.append([False] * (price + 1)) dp[0][ps[0]] = True dp[0][0] = True for i in range(1, len(ps)): for p in range(price + 1): if p >= ps[i]: dp[i][p] = dp[i - 1][p] or dp[i][p - ps[i]] else: dp[i][p] = dp[i - 1][p] p = -1 for i in range(0, price + 1): if is_prime[i] and dp[len(ps) - 1][i]: p = i if p == -1: print("NA") else: print(p) def main(): table = init() while True: n, price = map(int,raw_input().split()) if n == 0 and price == 0: return ps = [] for i in range(n): ps.append(int(raw_input())) solve(price, ps, table) main()
Traceback (most recent call last): File "/tmp/tmpcw52fi39/tmp_ccwul3h.py", line 54, in <module> main() File "/tmp/tmpcw52fi39/tmp_ccwul3h.py", line 46, in main n, price = map(int,raw_input().split()) ^^^^^^^^^ NameError: name 'raw_input' is not defined
s316125368
p00202
u871901071
1397311537
Python
Python
py
Runtime Error
0
0
1210
input = raw_input def init(): table = [True] * 1000001 table[0] = False table[1] = False n = len(table) for i in range(2, n): for j in range(i + i, n, i): table[j] = False return table def is_prime(p): if p == 0 or p == 1: return False for i in range(2, p - 1): if p % i == 0: return False return True def solve(price, ps, is_prime): dp = [] for i in range(len(ps)): dp.append([False] * (price + 1)) dp[0][ps[0]] = True dp[0][0] = True for i in range(1, len(ps)): for p in range(price + 1): if p >= ps[i]: dp[i][p] = dp[i - 1][p] or dp[i][p - ps[i]] else: dp[i][p] = dp[i - 1][p] p = -1 for i in range(0, price + 1): if is_prime[i] and dp[len(ps) - 1][i]: p = i if p == -1: print("NA") else: print(p) def main(): table = init() while True: n, price = map(int,input().split()) if n == 0 and price == 0: return ps = [] for i in range(n): ps.append(int(input())) solve(price, ps, table) main()
Traceback (most recent call last): File "/tmp/tmp4m62blix/tmpufl1o9nl.py", line 1, in <module> input = raw_input ^^^^^^^^^ NameError: name 'raw_input' is not defined
s919736373
p00202
u871901071
1397311849
Python
Python
py
Runtime Error
0
0
1210
input = raw_input def init(): table = [True] * 1000001 table[0] = False table[1] = False n = len(table) for i in range(2, n): for j in range(i + i, n, i): table[j] = False return table def is_prime(p): if p == 0 or p == 1: return False for i in range(2, p - 1): if p % i == 0: return False return True def solve(price, ps, is_prime): dp = [] for i in range(len(ps)): dp.append([False] * (price + 1)) dp[0][ps[0]] = True dp[0][0] = True for i in range(1, len(ps)): for p in range(price + 1): if p >= ps[i]: dp[i][p] = dp[i - 1][p] or dp[i][p - ps[i]] else: dp[i][p] = dp[i - 1][p] p = -1 for i in range(0, price + 1): if is_prime[i] and dp[len(ps) - 1][i]: p = i if p == -1: print("NA") else: print(p) def main(): table = init() while True: n, price = map(int,input().split()) if n == 0 and price == 0: return ps = [] for i in range(n): ps.append(int(input())) solve(price, ps, table) main()
Traceback (most recent call last): File "/tmp/tmp96x_u7bc/tmpv26py3nw.py", line 1, in <module> input = raw_input ^^^^^^^^^ NameError: name 'raw_input' is not defined
s315674315
p00202
u871901071
1397369979
Python
Python
py
Runtime Error
0
0
1210
input = raw_input def init(): table = [True] * 1000001 table[0] = False table[1] = False n = len(table) for i in range(2, n): for j in range(i + i, n, i): table[j] = False return table def is_prime(p): if p == 0 or p == 1: return False for i in range(2, p - 1): if p % i == 0: return False return True def solve(price, ps, is_prime): dp = [] for i in range(len(ps)): dp.append([False] * (price + 1)) dp[0][ps[0]] = True dp[0][0] = True for i in range(1, len(ps)): for p in range(price + 1): if p >= ps[i]: dp[i][p] = dp[i - 1][p] or dp[i][p - ps[i]] else: dp[i][p] = dp[i - 1][p] p = -1 for i in range(0, price + 1): if is_prime[i] and dp[len(ps) - 1][i]: p = i if p == -1: print("NA") else: print(p) def main(): table = init() while True: n, price = map(int,input().split()) if n == 0 and price == 0: return ps = [] for i in range(n): ps.append(int(input())) solve(price, ps, table) main()
Traceback (most recent call last): File "/tmp/tmpjzqwwg96/tmpjmn7yzfb.py", line 1, in <module> input = raw_input ^^^^^^^^^ NameError: name 'raw_input' is not defined
s013649940
p00202
u871901071
1397370023
Python
Python
py
Runtime Error
0
0
1210
input = raw_input def init(): table = [True] * 2000001 table[0] = False table[1] = False n = len(table) for i in range(2, n): for j in range(i + i, n, i): table[j] = False return table def is_prime(p): if p == 0 or p == 1: return False for i in range(2, p - 1): if p % i == 0: return False return True def solve(price, ps, is_prime): dp = [] for i in range(len(ps)): dp.append([False] * (price + 1)) dp[0][ps[0]] = True dp[0][0] = True for i in range(1, len(ps)): for p in range(price + 1): if p >= ps[i]: dp[i][p] = dp[i - 1][p] or dp[i][p - ps[i]] else: dp[i][p] = dp[i - 1][p] p = -1 for i in range(0, price + 1): if is_prime[i] and dp[len(ps) - 1][i]: p = i if p == -1: print("NA") else: print(p) def main(): table = init() while True: n, price = map(int,input().split()) if n == 0 and price == 0: return ps = [] for i in range(n): ps.append(int(input())) solve(price, ps, table) main()
Traceback (most recent call last): File "/tmp/tmpck1l9bxk/tmp4a3aen91.py", line 1, in <module> input = raw_input ^^^^^^^^^ NameError: name 'raw_input' is not defined
s587322654
p00202
u871901071
1397370085
Python
Python
py
Runtime Error
0
0
1052
input = raw_input def init(): table = [True] * 2000001 table[0] = False table[1] = False n = len(table) for i in range(2, n): for j in range(i + i, n, i): table[j] = False return table def solve(price, ps, is_prime): dp = [] for i in range(len(ps)): dp.append([False] * (price + 1)) dp[0][ps[0]] = True dp[0][0] = True for i in range(1, len(ps)): for p in range(price + 1): if p >= ps[i]: dp[i][p] = dp[i - 1][p] or dp[i][p - ps[i]] else: dp[i][p] = dp[i - 1][p] p = -1 for i in range(0, price + 1): if is_prime[i] and dp[len(ps) - 1][i]: p = i if p == -1: print("NA") else: print(p) def main(): table = init() while True: n, price = map(int,input().split()) if n == 0 and price == 0: return ps = [] for i in range(n): ps.append(int(input())) solve(price, ps, table) main()
Traceback (most recent call last): File "/tmp/tmph32j4a1a/tmpie44hlng.py", line 1, in <module> input = raw_input ^^^^^^^^^ NameError: name 'raw_input' is not defined
s047167725
p00202
u871901071
1397371308
Python
Python
py
Runtime Error
0
0
1401
from datetime import datetime def measure(f): measure_start = datetime.now() v = f() print(datetime.now() - measure_start) return v def init(): table = [True] * 1000001 table[0] = False table[1] = False n = len(table) def prime(p): for i in range(p + p, n, p): table[i] = False prime(2) prime(3) prime(5) prime(7) prime(11) prime(13) for i in range(2, n): if (i % 2 != 0 and i % 3 != 0 and i % 5 != 0 and i % 7 != 0 and i % 11 != 0 and i % 13 != 0): for j in range(i + i, n, i): table[j] = False return table def solve(price, ps, is_prime): dp = [False] * (price + 1) if ps[0] <= price: dp[ps[0]] = True dp[0] = True for i in range(1, len(ps)): cur_p = ps[i] for p in range(price + 1): if p >= cur_p: dp[p] = dp[p] or dp[p - cur_p] p = -1 for i in range(0, price + 1): if is_prime[i] and dp[i]: p = i if p == -1: print("NA") else: print(p) def main(): table = measure(lambda : init()) while True: n, price = map(int,input().split()) if n == 0 and price == 0: return ps = [] for i in range(n): ps.append(int(input())) solve(price, ps, table) main()
Traceback (most recent call last): File "/tmp/tmpmgc476x9/tmp9r87a2hg.py", line 65, in <module> main() File "/tmp/tmpmgc476x9/tmp9r87a2hg.py", line 57, in main n, price = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
0:00:00.092459
s098612977
p00202
u871901071
1397371635
Python
Python
py
Runtime Error
0
0
1402
from datetime import datetime def measure(f): measure_start = datetime.now() v = f() print(datetime.now() - measure_start) return v # input = raw_input def init(): table = [True] * 1000001 table[0] = False table[1] = False n = len(table) def prime(p): for i in range(p + p, n, p): table[i] = False prime(2) prime(3) prime(5) prime(7) prime(11) prime(13) for i in range(2, n): if (i % 2 != 0 and i % 3 != 0 and i % 5 != 0 and i % 7 != 0 and i % 11 != 0 and i % 13 != 0): for j in range(i + i, n, i): table[j] = False return table def solve(price, ps, is_prime): dp = [False] * (price + 1) if ps[0] <= price: dp[ps[0]] = True dp[0] = True for i in range(1, len(ps)): cur_p = ps[i] for p in range(cur_p, price + 1): dp[p] = dp[p] or dp[p - cur_p] p = -1 for i in range(0, price + 1): if is_prime[i] and dp[i]: p = i if p == -1: print("NA") else: print(p) def main(): table = measure(lambda : init()) while True: n, price = map(int,input().split()) if n == 0 and price == 0: return ps = [] for i in range(n): ps.append(int(input())) solve(price, ps, table) main()
Traceback (most recent call last): File "/tmp/tmp1nbsuaxz/tmp8n3djkkd.py", line 66, in <module> main() File "/tmp/tmp1nbsuaxz/tmp8n3djkkd.py", line 58, in main n, price = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
0:00:00.094039
s407160224
p00202
u871901071
1397377760
Python
Python
py
Runtime Error
0
0
2187
from datetime import datetime def measure(f): measure_start = datetime.now() v = f() print(datetime.now() - measure_start) return v # input = raw_input # range = xrange def init(): table = [True] * 1000001 table[0] = False table[1] = False n = len(table) def prime(p): for i in range(p + p, n, p): table[i] = False prime(2) prime(3) prime(5) prime(7) prime(11) prime(13) for i in range(2, n): if (i % 2 != 0 and i % 3 != 0 and i % 5 != 0 and i % 7 != 0 and i % 11 != 0 and i % 13 != 0): for j in range(i + i, n, i): table[j] = False return table def solve(price, ps, is_prime): dp = [0] * ((price >> 5) + 1) def get(i): return ((dp[i >> 5] >> (i & 31)) & 1) def set(i, v): dp[i >> 5] |= (v << (i & 31)) def get_p(i): return dp[i >> 5] def set_p(i, v): dp[i >> 5] |= v if ps[0] <= price: set(ps[0], 1) set(0, 1) for i in range(1, len(ps)): cur_p = ps[i] i1 = cur_p & 31 rest = 0 for p in range(cur_p, price + 1, 32): v = dp[(p - cur_p) >> 5] dp[p >> 5] |= (v << i1) | rest v = dp[(p - cur_p) >> 5] dp[p >> 5] |= (v << i1) | rest v = dp[(p - cur_p) >> 5] dp[p >> 5] |= (v << i1) | rest v = dp[(p - cur_p) >> 5] dp[p >> 5] |= (v << i1) | rest v = dp[(p - cur_p) >> 5] dp[p >> 5] |= (v << i1) | rest v = dp[(p - cur_p) >> 5] dp[p >> 5] |= (v << i1) | rest rest = (v >> (32 - i1)) & ((1 << i1) - 1) p = -1 for i in range(0, price + 1): if is_prime[i] and get(i) == 1: p = i if p == -1: print("NA") else: print(p) def main(): table = measure(lambda : init()) while True: n, price = map(int,input().split()) if n == 0 and price == 0: return ps = [] for i in range(n): ps.append(int(input())) solve(price, ps, table) main()
Traceback (most recent call last): File "/tmp/tmpbtweujvj/tmpka8puw0s.py", line 94, in <module> main() File "/tmp/tmpbtweujvj/tmpka8puw0s.py", line 86, in main n, price = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
0:00:00.111918
s169215662
p00202
u871901071
1397379200
Python
Python
py
Runtime Error
0
0
2700
from datetime import datetime def measure(f): measure_start = datetime.now() v = f() print(datetime.now() - measure_start) return v # input = raw_input # range = xrange def init(): table = [True] * 1000001 table[0] = False table[1] = False n = len(table) def prime(p): for i in range(p + p, n, p): table[i] = False prime(2) prime(3) prime(5) prime(7) prime(11) prime(13) for i in range(2, n): if (i % 2 != 0 and i % 3 != 0 and i % 5 != 0 and i % 7 != 0 and i % 11 != 0 and i % 13 != 0): for j in range(i + i, n, i): table[j] = False return table def solve(price, ps, is_prime): dp = [0] * ((price >> 6) + 1) for i in range(0, price + 1,ps[0]): dp[i >> 6] |= 1 << (i & 63) dp[0] = 1 for i in range(1, len(ps)): cur_p = ps[i] r = cur_p & 63 rest = 0 for p in range(cur_p, price + 1, 64): i1 = (p - cur_p) >> 6 i2 = p >> 6 v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest rest = (v >> (64 - r)) & ((1 << r) - 1) p = -1 for i in range(0, price + 1): if is_prime[i] and (dp[i >> 6] >> (i & 63)) & 1 == 1: p = i if p == -1: print("NA") else: print(p) def main(): table = init() while True: n, price = map(int,input().split()) if n == 0 and price == 0: return ps = [] for i in range(n): ps.append(int(input())) solve(price, ps, table) main()
Traceback (most recent call last): File "/tmp/tmp7qwhzcb1/tmpxk40g3qq.py", line 109, in <module> main() File "/tmp/tmp7qwhzcb1/tmpxk40g3qq.py", line 101, in main n, price = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s378077993
p00202
u871901071
1397379515
Python
Python
py
Runtime Error
0
0
1650
from datetime import datetime def measure(f): measure_start = datetime.now() v = f() print(datetime.now() - measure_start) return v # input = raw_input # range = xrange def init(): table = [True] * 1000001 table[0] = False table[1] = False n = len(table) def prime(p): for i in range(p + p, n, p): table[i] = False prime(2) prime(3) prime(5) prime(7) prime(11) prime(13) for i in range(2, n): if (i % 2 != 0 and i % 3 != 0 and i % 5 != 0 and i % 7 != 0 and i % 11 != 0 and i % 13 != 0): for j in range(i + i, n, i): table[j] = False return table def solve(price, ps, is_prime): dp = [0] * ((price >> 6) + 1) for i in range(0, price + 1,ps[0]): dp[i >> 6] |= 1 << (i & 63) dp[0] = 1 for i in range(1, len(ps)): cur_p = ps[i] r = cur_p & 63 rest = 0 for p in range(cur_p, price + 1, 64): i1 = (p - cur_p) >> 6 i2 = p >> 6 v = dp[i1] dp[i2] |= (v << r) | rest rest = (v >> (64 - r)) & ((1 << r) - 1) p = -1 for i in range(0, price + 1): if is_prime[i] and (dp[i >> 6] >> (i & 63)) & 1 == 1: p = i if p == -1: print("NA") else: print(p) def main(): table = init() while True: n, price = map(int,input().split()) if n == 0 and price == 0: return ps = [] for i in range(n): ps.append(int(input())) solve(price, ps, table) main()
Traceback (most recent call last): File "/tmp/tmp0j5a1n17/tmp453wxf66.py", line 74, in <module> main() File "/tmp/tmp0j5a1n17/tmp453wxf66.py", line 66, in main n, price = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s480626022
p00202
u871901071
1397379762
Python
Python
py
Runtime Error
0
0
1711
from datetime import datetime def measure(f): measure_start = datetime.now() v = f() print(datetime.now() - measure_start) return v # input = raw_input # range = xrange def init(): table = [True] * 1000001 table[0] = False table[1] = False n = len(table) def prime(p): for i in range(p + p, n, p): table[i] = False prime(2) prime(3) prime(5) prime(7) prime(11) prime(13) for i in range(2, n): if (i % 2 != 0 and i % 3 != 0 and i % 5 != 0 and i % 7 != 0 and i % 11 != 0 and i % 13 != 0): for j in range(i + i, n, i): table[j] = False return table def solve(price, ps, is_prime): dp = [0] * ((price >> 6) + 1) for i in range(0, price + 1,ps[0]): dp[i >> 6] |= 1 << (i & 63) dp[0] = 1 for i in range(1, len(ps)): cur_p = ps[i] r = cur_p & 63 rest = 0 for p in range(cur_p, price + 1, 64): i1 = (p - cur_p) >> 6 i2 = p >> 6 v = dp[i1] dp[i2] |= (v << r) | rest v = dp[i1] dp[i2] |= (v << r) | rest rest = (v >> (64 - r)) & ((1 << r) - 1) p = -1 for i in range(0, price + 1): if is_prime[i] and (dp[i >> 6] >> (i & 63)) & 1 == 1: p = i if p == -1: print("NA") else: print(p) def main(): table = init() while True: n, price = map(int,input().split()) if n == 0 and price == 0: return ps = [] for i in range(n): ps.append(int(input())) solve(price, ps, table) main()
Traceback (most recent call last): File "/tmp/tmplgwln3ua/tmpz2ehzsce.py", line 76, in <module> main() File "/tmp/tmplgwln3ua/tmpz2ehzsce.py", line 68, in main n, price = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s931764273
p00202
u633068244
1399111543
Python
Python
py
Runtime Error
0
0
446
r = 1000001 s = int(r*0.5) p = [1]*r p[0] = p[1] = 0 for i in range(2,s+1): if p[i]: p[2*i::i] = [0 for _ in range(2*i,r,i)] while 1: n,x = map(int,raw_input().split()) if n == 0: break dish = [int(raw_input()) for i in range(n)] dp = [0]*(x+1) for i in dish: dp[i] = 1 for cost in dish: for j in range(x-i+1): if dp[j] == 1: dp[j+cost] = 1 for i in range(x,1,-1): if p[i] and dp[i]: print i break else: print "NA"
File "/tmp/tmpyhntwdhv/tmpcxrbhd26.py", line 21 print i ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s303887874
p00202
u633068244
1399111596
Python
Python
py
Runtime Error
0
0
446
r = 1000001 s = int(r*0.5) p = [1]*r p[0] = p[1] = 0 for i in range(2,s+1): if p[i]: p[2*i::i] = [0 for _ in range(2*i,r,i)] while 1: n,x = map(int,raw_input().split()) if n == 0: break dish = [int(raw_input()) for i in range(n)] dp = [0]*(x+1) for i in dish: dp[i] = 1 for cost in dish: for j in range(x-i+1): if dp[j] == 1: dp[j+cost] = 1 for i in range(x,1,-1): if p[i] and dp[i]: print i break else: print "NA"
File "/tmp/tmpk2iaiumb/tmp2o5i0u_p.py", line 21 print i ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s428374760
p00202
u633068244
1399111673
Python
Python
py
Runtime Error
0
0
460
r = 1000001 s = int(r*0.5) p = [1]*r p[0] = p[1] = 0 for i in range(2,s+1): if p[i]: p[2*i::i] = [0 for _ in range(2*i,r,i)] while 1: n,x = map(int,raw_input().split()) if n == 0: break dish = [int(raw_input()) for i in range(n)] dp = [0]*(x+1) for i in dish: if i <= x: dp[i] = 1 for cost in dish: for j in range(x-i+1): if dp[j] == 1: dp[j+cost] = 1 for i in range(x,1,-1): if p[i] and dp[i]: print i break else: print "NA"
File "/tmp/tmp1rpv05lu/tmpzsuh9clu.py", line 22 print i ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s959246464
p00202
u633068244
1399111750
Python
Python
py
Runtime Error
0
0
449
r = 1000001 s = int(r*0.5) p = [1]*r p[0] = p[1] = 0 for i in range(2,s+1): if p[i]: p[2*i::i] = [0 for _ in range(2*i,r,i)] while 1: n,x = map(int,raw_input().split()) if n == 0: break dish = [int(raw_input()) for i in range(n)] dp = [0]*(x+1) for i in dish: dp[i] = 1 for cost in dish: for j in range(x-cost+1): if dp[j] == 1: dp[j+cost] = 1 for i in range(x,1,-1): if p[i] and dp[i]: print i break else: print "NA"
File "/tmp/tmp_3dnepss/tmpt7j_m1fm.py", line 21 print i ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s115837398
p00202
u633068244
1399114004
Python
Python
py
Runtime Error
0
0
599
r = 1000001 s = int(r**0.5) p = [1]*r p[0] = p[1] = 0 for i in range(2,s+1): if p[i]: p[2*i::i] = [0 for _ in range(2*i,r,i)] while 1: n,x = map(int,raw_input().split()) if n == 0: break dish = [int(raw_input()) for i in range(n)] c = 0 pay = [0]*(x+1) ref = [0]*(x+1) for i in dish: pay[c] = i ref[c] = 1 c += 1 for cost in dish: for j in pay: if j == 0: break nwcost = j + cost if nwcost <= x and ref[nwcost] == 0: pay[c] = nwcost ref[nwcost] = 1 c += 1 for i in sorted(pay[:pay.index(0)],reverse = True): if p[i]: print i break else: print "NA"
File "/tmp/tmp0gx43xi5/tmpx6qwhepw.py", line 29 print i ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s751081714
p00203
u266872031
1428070905
Python
Python
py
Runtime Error
0
0
901
while(1): [X,Y]=[int(x) for x in raw_input().split()] if X==0: break else: F=[] for i in range(Y): F.append([0]+[int(x) for x in raw_input().split()]+[0]) F.append([3 for x in range(X+2)]) S=[[0 for x in range(X+2)] for y in range(Y+1)] #F,S[y][x] #initilizing for i in range(1,X+1): S[0][i]=1-F[0][i] for j in range(Y+1): for i in range(1,X+1): if F[j][i]==2: S[j][i]=S[j][i]+S[j-1][i] S[j+2][i]=S[j+2][i]+S[j][i] elif F[j][i]==1: S[j][i]=0 elif F[j][i]==3: S[j][i]=S[j][i]+S[j-1][i] else: S[j][i]=S[j][i]+(1-F[j-1][i]/2)*S[j-1][i]+(1-F[j-1][i-1]/2)*S[j-1][i-1]+(1-F[j-1][i+1]/2)*S[j-1][i+1] print sum(S[Y])
File "/tmp/tmppepbcw_t/tmp9mcjqyo1.py", line 26 print sum(S[Y]) ^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s676790581
p00203
u755162050
1471430825
Python
Python3
py
Runtime Error
0
0
1436
""" Created by Jieyi on 8/16/16. """ def algorithm(): def down_jump(x, y, times): if x == r: out_map[x - 1][y] += times elif in_map[x][y] == 2: down_jump(x + 2, y, times) else: out_map[x][y] += times while True: c, r = map(int, input().split()) if c == 0 and r == 0: break in_map = [] out_map = [[0 for _ in range(c)] for _ in range(r)] for _ in range(r): in_map.append(list(map(int, input().split()))) for i in range(r): if in_map[0][i] == 0: out_map[0][i] = 1 for i in range(r): for j in range(c): if in_map[i][j] == 0: # ???. if i + 1 < r and j > 0 and in_map[i + 1][j - 1] == 0: out_map[i + 1][j - 1] += out_map[i][j] # ???. if i + 1 < r and in_map[i + 1][j] == 0: out_map[i + 1][j] += out_map[i][j] elif i + 1 < r and in_map[i + 1][j] == 2: down_jump(i + 1, j, out_map[i][j]) # ???. if i + 1 < r and j + 1 < c and in_map[i + 1][j + 1] == 0: out_map[i + 1][j + 1] += out_map[i][j] print(sum(out_map[c - 1])) def main(): algorithm() if __name__ == '__main__': main()
Traceback (most recent call last): File "/tmp/tmpzw3q7pqb/tmp36u27wop.py", line 50, in <module> main() File "/tmp/tmpzw3q7pqb/tmp36u27wop.py", line 46, in main algorithm() File "/tmp/tmpzw3q7pqb/tmp36u27wop.py", line 14, in algorithm c, r = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s175748503
p00203
u755162050
1471431291
Python
Python3
py
Runtime Error
0
0
1496
""" Created by Jieyi on 8/16/16. """ def algorithm(): def down_jump(x, y, times): if x == r: out_map[x - 1][y] += times elif x == r - 1: out_map[x][y] += times elif in_map[x][y] == 2: down_jump(x + 2, y, times) else: out_map[x][y] += times while True: c, r = map(int, input().split()) if c == 0 and r == 0: break in_map = [] out_map = [[0 for _ in range(c)] for _ in range(r)] for _ in range(r): in_map.append(list(map(int, input().split()))) for i in range(r): if in_map[0][i] == 0: out_map[0][i] = 1 for i in range(r): for j in range(c): if in_map[i][j] == 0: # ???. if i + 1 < r and j > 0 and in_map[i + 1][j - 1] == 0: out_map[i + 1][j - 1] += out_map[i][j] # ???. if i + 1 < r and in_map[i + 1][j] == 0: out_map[i + 1][j] += out_map[i][j] elif i + 1 < r and in_map[i + 1][j] == 2: down_jump(i + 1, j, out_map[i][j]) # ???. if i + 1 < r and j + 1 < c and in_map[i + 1][j + 1] == 0: out_map[i + 1][j + 1] += out_map[i][j] print(sum(out_map[c - 1])) def main(): algorithm() if __name__ == '__main__': main()
Traceback (most recent call last): File "/tmp/tmptguo8ajt/tmpqgd4lsdr.py", line 52, in <module> main() File "/tmp/tmptguo8ajt/tmpqgd4lsdr.py", line 48, in main algorithm() File "/tmp/tmptguo8ajt/tmpqgd4lsdr.py", line 16, in algorithm c, r = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s918790574
p00203
u755162050
1471432103
Python
Python3
py
Runtime Error
0
0
1540
""" Created by Jieyi on 8/16/16. """ def algorithm(): def down_jump(x, y, times): if x == r: out_map[x - 1][y] += times elif x == r - 1: out_map[x][y] += times elif in_map[x][y] == 2: down_jump(x + 2, y, times) else: out_map[x][y] += times while True: c, r = map(int, input().split()) if c == 0 and r == 0: break in_map = [] out_map = [[0 for _ in range(c)] for _ in range(r)] for _ in range(r): in_map.append(list(map(int, input().split()))) for i in range(c): if in_map[0][i] == 0 or in_map[0][i] == 2: out_map[0][i] = 1 for i in range(r): for j in range(c): if in_map[i][j] == 0: # ???. if i + 1 < r and j > 0 and in_map[i + 1][j - 1] == 0: out_map[i + 1][j - 1] += out_map[i][j] # ???. if i + 1 < r and in_map[i + 1][j] == 0: out_map[i + 1][j] += out_map[i][j] elif i + 1 < r and in_map[i + 1][j] == 2: down_jump(i + 1, j, out_map[i][j]) # ???. if i + 1 < r and j + 1 < c and in_map[i + 1][j + 1] == 0: out_map[i + 1][j + 1] += out_map[i][j] print(out_map) print(sum(out_map[c - 1])) def main(): algorithm() if __name__ == '__main__': main()
Traceback (most recent call last): File "/tmp/tmpbb196sov/tmp3puucu_l.py", line 53, in <module> main() File "/tmp/tmpbb196sov/tmp3puucu_l.py", line 49, in main algorithm() File "/tmp/tmpbb196sov/tmp3puucu_l.py", line 16, in algorithm c, r = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s905198523
p00203
u811733736
1509283225
Python
Python3
py
Runtime Error
0
0
2623
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203 """ import sys from sys import stdin from collections import deque, defaultdict input = stdin.readline def solve(field): 0 0 # 0: ????????°, 1: ?????????, 2: ?????£????????° course = 0 # ?????????????????????????????? dy = [1, 1, 1] dx = [0, -1, 1] x_limit = len(field[0]) y_limit = len(field) path = defaultdict(int) Q = deque() for x, m in enumerate(field[0]): if m == 0: Q.append((x, 0)) t = '{}_{}'.format(x, 0) path[t] = 1 while Q: cx, cy = Q.popleft() # ?????¨??°?????§?¨? t = '{}_{}'.format(cx, cy) num = path.pop(t) if cy+1 == y_limit: course += num continue if field[cy][cx] == 2: if cy+2 >= y_limit: course += num else: t = '{}_{}'.format(cx, cy) if path[t]: path[t] += num else: Q.append((cx, cy+2)) path[t] = num continue for i in range(len(dx)): nx = cx + dx[i] ny = cy + dy[i] # ?§????????????§???????????? ?????? ??¢?????¢?´¢?????§???????????°??????????????§?????¢?´¢????¶??????? if 0<= nx < x_limit: if ny >= y_limit: course += num else: if field[ny][nx] == 2 and dx[i] == 0: if ny+2 >= y_limit: course += num else: t = '{}_{}'.format(nx, ny+2) if path[t]: path[t] += num else: path[t] = num Q.append((nx, ny+2)) elif field[ny][nx] == 0: t = '{}_{}'.format(nx, ny) if path[t]: path[t] += num else: path[t] = num Q.append((nx, ny)) return course def main(args): while True: X, Y = map(int, input().split()) if X == 0 and Y == 0: break field = [] for _ in range(Y): temp = [int(x) for x in input().split()] field.append(temp) result = solve(field) print(result) if __name__ == '__main__': main(sys.argv[1:])
File "/tmp/tmp2a9mr0oa/tmpkd5bty27.py", line 13 0 0 # 0: ????????°, 1: ?????????, 2: ?????£????????° ^ IndentationError: expected an indented block after function definition on line 12
s730315627
p00203
u811733736
1509284411
Python
Python3
py
Runtime Error
0
0
2630
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203 """ import sys from sys import stdin from collections import deque, defaultdict input = stdin.readline def solve(field): # 0: ????????°, 1: ?????????, 2: ?????£????????° course = 0 # ?????????????????????????????? dy = [1, 1, 1] dx = [0, -1, 1] x_limit = len(field[0]) y_limit = len(field) path = defaultdict(int) # ??????????????????????????°???????????° Q = deque() for x, m in enumerate(field[0]): if m == 0: Q.append((x, 0)) t = '{}_{}'.format(x, 0) path[t] = 1 while Q: cx, cy = Q.popleft() # ?????¨??°?????§?¨? t = '{}_{}'.format(cx, cy) num = path.pop(t) if field[cy][cx] == 2: if cy+2 >= y_limit-1: course += num else: t = '{}_{}'.format(cx, cy) if path[t]: path[t] += num else: Q.append((cx, cy+2)) path[t] = num continue for i in range(len(dx)): nx = cx + dx[i] ny = cy + dy[i] # ?§????????????§???????????? ?????? ??¢?????¢?´¢?????§???????????°??????????????§?????¢?´¢????¶??????? if 0<= nx < x_limit: if ny >= y_limit - 1 and field[ny][nx] != 1: course += num else: if field[ny][nx] == 2 and dx[i] == 0: if ny+2 >= y_limit - 1: course += num else: t = '{}_{}'.format(nx, ny+2) if path[t]: path[t] += num else: path[t] = num Q.append((nx, ny+2)) elif field[ny][nx] == 0: t = '{}_{}'.format(nx, ny) if path[t]: path[t] += num else: path[t] = num Q.append((nx, ny)) return course def main(args): while True: X, Y = map(int, input().split()) if X == 0 and Y == 0: break field = [] for _ in range(Y): temp = [int(x) for x in input().split()] field.append(temp) result = solve(field) print(result) if __name__ == '__main__': main(sys.argv[1:])
Traceback (most recent call last): File "/tmp/tmpj0be1tdv/tmpc6fka5fx.py", line 91, in <module> main(sys.argv[1:]) File "/tmp/tmpj0be1tdv/tmpc6fka5fx.py", line 79, in main X, Y = map(int, input().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s346345430
p00203
u811733736
1509284613
Python
Python3
py
Runtime Error
0
0
2673
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203 """ import sys from sys import stdin from collections import deque, defaultdict input = stdin.readline def solve(field): # 0: ????????°, 1: ?????????, 2: ?????£????????° course = 0 # ?????????????????????????????? dy = [1, 1, 1] dx = [0, -1, 1] x_limit = len(field[0]) y_limit = len(field) path = defaultdict(int) # ??????????????????????????°???????????° Q = deque() for x, m in enumerate(field[0]): if m == 0: Q.append((x, 0)) t = '{}_{}'.format(x, 0) path[t] = 1 if x_limit == 1: return len(Q) while Q: cx, cy = Q.popleft() # ?????¨??°?????§?¨? t = '{}_{}'.format(cx, cy) num = path.pop(t) if field[cy][cx] == 2: if cy+2 >= y_limit-1: course += num else: t = '{}_{}'.format(cx, cy) if path[t]: path[t] += num else: Q.append((cx, cy+2)) path[t] = num continue for i in range(len(dx)): nx = cx + dx[i] ny = cy + dy[i] # ?§????????????§???????????? ?????? ??¢?????¢?´¢?????§???????????°??????????????§?????¢?´¢????¶??????? if 0<= nx < x_limit: if ny >= y_limit - 1 and field[ny][nx] != 1: course += num else: if field[ny][nx] == 2 and dx[i] == 0: if ny+2 >= y_limit - 1: course += num else: t = '{}_{}'.format(nx, ny+2) if path[t]: path[t] += num else: path[t] = num Q.append((nx, ny+2)) elif field[ny][nx] == 0: t = '{}_{}'.format(nx, ny) if path[t]: path[t] += num else: path[t] = num Q.append((nx, ny)) return course def main(args): while True: X, Y = map(int, input().split()) if X == 0 and Y == 0: break field = [] for _ in range(Y): temp = [int(x) for x in input().split()] field.append(temp) result = solve(field) print(result) if __name__ == '__main__': main(sys.argv[1:])
Traceback (most recent call last): File "/tmp/tmp7hjqdq94/tmpx1l_2q_z.py", line 93, in <module> main(sys.argv[1:]) File "/tmp/tmp7hjqdq94/tmpx1l_2q_z.py", line 81, in main X, Y = map(int, input().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s593868251
p00203
u811733736
1509285227
Python
Python3
py
Runtime Error
0
0
2673
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203 """ import sys from sys import stdin from collections import deque, defaultdict input = stdin.readline def solve(field): # 0: ????????°, 1: ?????????, 2: ?????£????????° ans = 0 # ?????????????????????????????? dy = [1, 1, 1] dx = [0, -1, 1] x_limit = len(field[0]) y_limit = len(field) path = defaultdict(int) # ??????????????????????????°???????????° Q = deque() for x, m in enumerate(field[0]): if m == 0: Q.append((x, 0)) t = '{}_{}'.format(x, 0) path[t] = 1 if x_limit == 1: return len(Q) while Q: cx, cy = Q.popleft() # ?????¨??°?????§?¨? t = '{}_{}'.format(cx, cy) num = path.pop(t) if field[cy][cx] == 2: if cy+2 >= y_limit-1: ans += num else: t = '{}_{}'.format(cx, cy) if path[t]: path[t] += num else: Q.append((cx, cy+2)) path[t] = num continue for i in range(len(dx)): nx = cx + dx[i] ny = cy + dy[i] # ?§????????????§???????????? ?????? ??¢?????¢?´¢?????§???????????°??????????????§?????¢?´¢????¶??????? if 0<= nx < x_limit: if ny >= y_limit - 1 and field[ny][nx] != 1: ans += num else: if field[ny][nx] == 2 and dx[i] == 0: if ny+2 >= y_limit - 1: ans += num else: t = '{}_{}'.format(nx, ny+2) if path[t]: path[t] += num else: path[t] = num Q.append((nx, ny+2)) elif field[ny][nx] == 0: t = '{}_{}'.format(nx, ny) if path[t]: path[t] += num else: path[t] = num Q.append((nx, ny)) return ans def main(args): while True: X, Y = map(int, input().strip().split()) if X == 0 and Y == 0: break field = [] for _ in range(Y): temp = [int(x) for x in input().strip().split()] field.append(temp) result = solve(field) print(result) if __name__ == '__main__': main(sys.argv[1:])
Traceback (most recent call last): File "/tmp/tmpz0ecjdc8/tmpq3skcg3k.py", line 92, in <module> main(sys.argv[1:]) File "/tmp/tmpz0ecjdc8/tmpq3skcg3k.py", line 80, in main X, Y = map(int, input().strip().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s359985893
p00203
u811733736
1509285366
Python
Python3
py
Runtime Error
0
0
2672
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203 """ import sys from sys import stdin from collections import deque, defaultdict input = stdin.readline def solve(field): # 0: ????????°, 1: ?????????, 2: ?????£????????° ans = 0 # ?????????????????????????????? dy = [1, 1, 1] dx = [0, -1, 1] x_limit = len(field[0]) y_limit = len(field) path = defaultdict(int) # ??????????????????????????°???????????° Q = deque() for x, m in enumerate(field[0]): if m == 0: Q.append((x, 0)) t = '{}_{}'.format(x, 0) path[t] = 1 if y_limit < 2: return len(Q) while Q: cx, cy = Q.popleft() # ?????¨??°?????§?¨? t = '{}_{}'.format(cx, cy) num = path.pop(t) if field[cy][cx] == 2: if cy+2 >= y_limit-1: ans += num else: t = '{}_{}'.format(cx, cy) if path[t]: path[t] += num else: Q.append((cx, cy+2)) path[t] = num continue for i in range(len(dx)): nx = cx + dx[i] ny = cy + dy[i] # ?§????????????§???????????? ?????? ??¢?????¢?´¢?????§???????????°??????????????§?????¢?´¢????¶??????? if 0<= nx < x_limit: if ny >= y_limit - 1 and field[ny][nx] != 1: ans += num else: if field[ny][nx] == 2 and dx[i] == 0: if ny+2 >= y_limit - 1: ans += num else: t = '{}_{}'.format(nx, ny+2) if path[t]: path[t] += num else: path[t] = num Q.append((nx, ny+2)) elif field[ny][nx] == 0: t = '{}_{}'.format(nx, ny) if path[t]: path[t] += num else: path[t] = num Q.append((nx, ny)) return ans def main(args): while True: X, Y = map(int, input().strip().split()) if X == 0 and Y == 0: break field = [] for _ in range(Y): temp = [int(x) for x in input().strip().split()] field.append(temp) result = solve(field) print(result) if __name__ == '__main__': main(sys.argv[1:])
Traceback (most recent call last): File "/tmp/tmprdv0gss7/tmp88k92j7k.py", line 92, in <module> main(sys.argv[1:]) File "/tmp/tmprdv0gss7/tmp88k92j7k.py", line 80, in main X, Y = map(int, input().strip().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s957320368
p00203
u811733736
1509291157
Python
Python3
py
Runtime Error
0
0
2726
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203 """ import sys from sys import stdin from collections import deque, defaultdict input = stdin.readline def solve(field): # 0: ????????°, 1: ?????????, 2: ?????£????????° ans = 0 # ??????????????°???????????° dy = [1, 1, 1] # ?????????????????????????????????????§??????? dx = [0, -1, 1] x_limit = len(field[0]) y_limit = len(field) path = defaultdict(int) # ??????????????????????????°???????????° Q = deque() for x, m in enumerate(field[0]): if m == 0: # ?????????????????°?????´????????????????????????????????? Q.append((x, 0)) t = '{}_{}'.format(x, 0) path[t] = 1 if y_limit < 2: return len(Q) while Q: cx, cy = Q.popleft() # ?????¨??°?????§?¨? t = '{}_{}'.format(cx, cy) num = path.pop(t) if field[cy][cx] == 1: # ?????£????????§?????°????????????????????? continue elif field[cy][cx] == 2: # ?????£????????§?????°?????????????????£????????° if cy+2 >= y_limit-1: ans += num else: t = '{}_{}'.format(cx, cy+2) if not path[t]: Q.append((cx, cy+2)) path[t] += num continue for i in range(len(dx)): nx = cx + dx[i] # ?????°????????§?¨? ny = cy + dy[i] if 0<= nx < x_limit: if ny >= y_limit - 1 and field[ny][nx] != 1: ans += num else: if field[ny][nx] == 2 and dx[i] == 0: # ?????£????????°????????£??????????????\????????´??? if ny+2 > y_limit - 1: ans += num else: t = '{}_{}'.format(nx, ny+2) if not path[t]: Q.append((nx, ny+2)) path[t] += num elif field[ny][nx] == 0: t = '{}_{}'.format(nx, ny) if not path[t]: Q.append((nx, ny)) path[t] += num return ans def main(args): while True: X, Y = map(int, input().strip().split()) if X == 0 and Y == 0: break field = [] for _ in range(Y): temp = [int(x) for x in input().strip().split()] field.append(temp) result = solve(field) print(result) if __name__ == '__main__': main(sys.argv[1:])
Traceback (most recent call last): File "/tmp/tmpfbhg0ufy/tmp2e5qwbug.py", line 86, in <module> main(sys.argv[1:]) File "/tmp/tmpfbhg0ufy/tmp2e5qwbug.py", line 74, in main X, Y = map(int, input().strip().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s419436949
p00203
u811733736
1509293045
Python
Python3
py
Runtime Error
0
0
2718
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203 """ import sys from sys import stdin from collections import deque, defaultdict input = stdin.readline def solve(field): BLANK, OBSTACLE, JUMP = 0, 1, 2 ans = 0 # ??????????????°???????????° dy = [1, 1, 1] # ?????????????????????????????????????§??????? dx = [0, -1, 1] x_limit = len(field[0]) y_limit = len(field) path = defaultdict(int) # ??????????????????????????°???????????°????????????'x???_y???'??????????????? Q = deque() for x, m in enumerate(field[0]): if m == BLANK: # ?????????????????°?????´????????????????????????????????? t = '{}_{}'.format(x, 0) Q.append((x, 0)) path[t] = 1 if y_limit < 2: return len(Q) while Q: cx, cy = Q.popleft() # ?????¨??°?????§?¨? t = '{}_{}'.format(cx, cy) num = path.pop(t) if field[cy][cx] == OBSTACLE: continue if field[cy][cx] == JUMP: # ?????£????????§?????°?????????????????£????????° if cy+2 >= y_limit-1: ans += num else: t = '{}_{}'.format(cx, cy+2) if not path[t]: Q.append((cx, cy+2)) path[t] += num continue for i in range(len(dx)): nx = cx + dx[i] # ?????°????????§?¨? ny = cy + dy[i] if 0<= nx < x_limit: if (ny >= y_limit - 1) and field[ny][nx] != OBSTACLE: ans += num else: if field[ny][nx] == JUMP and dx[i] == 0: # ?????£????????°????????£??????????????\????????´??? if ny+2 > y_limit - 1: ans += num else: t = '{}_{}'.format(nx, ny+2) if not path[t]: Q.append((nx, ny+2)) path[t] += num elif field[ny][nx] == BLANK: t = '{}_{}'.format(nx, ny) if not path[t]: Q.append((nx, ny)) path[t] += num return ans def main(args): while True: X, Y = map(int, input().strip().split()) if X == 0 and Y == 0: break field = [] for _ in range(Y): temp = [int(x) for x in input().strip().split()] field.append(temp) result = solve(field) print(result) if __name__ == '__main__': main(sys.argv[1:])
Traceback (most recent call last): File "/tmp/tmpcjyfl4ez/tmp_wr_y0ed.py", line 87, in <module> main(sys.argv[1:]) File "/tmp/tmpcjyfl4ez/tmp_wr_y0ed.py", line 75, in main X, Y = map(int, input().strip().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s212604317
p00203
u811733736
1509293061
Python
Python3
py
Runtime Error
0
0
2768
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203 """ import sys from sys import stdin from collections import deque, defaultdict input = stdin.readline def solve(field): BLANK, OBSTACLE, JUMP = 0, 1, 2 ans = 0 # ??????????????°???????????° dy = [1, 1, 1] # ?????????????????????????????????????§??????? dx = [0, -1, 1] x_limit = len(field[0]) y_limit = len(field) path = defaultdict(int) # ??????????????????????????°???????????°????????????'x???_y???'??????????????? Q = deque() for x, m in enumerate(field[0]): if m == BLANK: # ?????????????????°?????´????????????????????????????????? t = '{}_{}'.format(x, 0) Q.append((x, 0)) path[t] = 1 if y_limit < 2: return len(Q) while Q: cx, cy = Q.popleft() # ?????¨??°?????§?¨? t = '{}_{}'.format(cx, cy) num = path.pop(t) if cy > y_limit - 1: continue if field[cy][cx] == OBSTACLE: continue if field[cy][cx] == JUMP: # ?????£????????§?????°?????????????????£????????° if cy+2 >= y_limit-1: ans += num else: t = '{}_{}'.format(cx, cy+2) if not path[t]: Q.append((cx, cy+2)) path[t] += num continue for i in range(len(dx)): nx = cx + dx[i] # ?????°????????§?¨? ny = cy + dy[i] if 0<= nx < x_limit: if (ny >= y_limit - 1) and field[ny][nx] != OBSTACLE: ans += num else: if field[ny][nx] == JUMP and dx[i] == 0: # ?????£????????°????????£??????????????\????????´??? if ny+2 > y_limit - 1: ans += num else: t = '{}_{}'.format(nx, ny+2) if not path[t]: Q.append((nx, ny+2)) path[t] += num elif field[ny][nx] == BLANK: t = '{}_{}'.format(nx, ny) if not path[t]: Q.append((nx, ny)) path[t] += num return ans def main(args): while True: X, Y = map(int, input().strip().split()) if X == 0 and Y == 0: break field = [] for _ in range(Y): temp = [int(x) for x in input().strip().split()] field.append(temp) result = solve(field) print(result) if __name__ == '__main__': main(sys.argv[1:])
Traceback (most recent call last): File "/tmp/tmponx4l8de/tmp795ek91i.py", line 89, in <module> main(sys.argv[1:]) File "/tmp/tmponx4l8de/tmp795ek91i.py", line 77, in main X, Y = map(int, input().strip().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s446567865
p00204
u673933691
1414165428
Python
Python3
py
Runtime Error
0
0
1221
import math ans = [] while True: ufo = [] n = raw_input().split() if n == ["0", "0"]: for an in ans: print an break else: R = int(n[0]) for i in range(int(n[1])): m = [int(f) for f in raw_input().split()] l = math.sqrt(m[0] ** 2 + m[1] ** 2) ufo.append([l, l, (m[0], m[1]), m[2], m[3]]) a = 0 while len(ufo) > 0: flag = True for xs in ufo: xs[0] -= xs[4] ufo.sort() for xs in ufo[:]: if xs[0] <= R: a += 1 ufo.remove(xs) continue elif flag: r = xs[1] pos = xs[2] ufo.remove(xs) flag = False continue else: d = xs[0] / xs[1] * abs(pos[0] * xs[2][1] - pos[1] * xs[2][0]) / r if d <= xs[3]: if xs[0] * math.cos(math.atan2(xs[2][1], xs[2][0]) - math.atan2(pos[1], pos[0])) + math.sqrt(xs[3] ** 2 - d ** 2) > R: ufo.remove(xs) else: ans.append(a)
File "/tmp/tmpj3j8q7zg/tmpi89gdtwg.py", line 8 print an ^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s441542957
p00204
u180584272
1426675223
Python
Python
py
Runtime Error
0
0
12949
from math import sqrt,fabs,ceil,floor,pow,exp,log,sin,cos,tan,asin,acos,atan,atan2,pi eps=1e-10 inf=float("inf") class Angle: #angle. kaku. def __init__(self,th): self.th = float(th)%(2*pi) def __float__(self): return self.th def __eq__(self,other): return abs(float(self)-float(other))<eps or abs(abs(float(self)-float(other))-2*pi)<eps def isParaWith(self,other): return self==other or self==other+pi def __add__(self,other): return Angle( (float(self) + float(other)) % (2*pi) ) def __sub__(self,other): return Angle( (float(self) - float(other)) % (2*pi) ) def __mul__(self,c): return Angle( (float(self) * c) % (2*pi) ) def __rmul__(self,c): return Angle( (float(self) * c) % (2*pi) ) def __div__(self,c): return Angle( (float(self) / c) % (2*pi) ) def __repr__(self): return "Angle("+str(float(self))+")" class Vector: #point, vector. ten, bekutoru. def __init__(self,x=None,y=None,d=None,th=None): if not(x is None) and not(y is None): self.setXY(x,y) if not(d is None) and not(th is None): self.setDTh(d, th) def setXY(self,x,y): self.x=float(x); self.y=float(y); self.calcFromXY() def setDTh(self,d,th): self.d=float(d) self.th=Angle(th) self.calcFromDTh() def calcFromXY(self): self.d=sqrt(self.x**2+self.y**2) self.th=Angle(atan2(self.y,self.x)) def calcFromDTh(self): self.x=self.d*cos(self.th) self.y=self.d*sin(self.th) def e(self): return self/self.d def __eq__(self,other): return fabs(self.x-other.x)<eps and fabs(self.y-other.y)<eps def isParaWith(self,other): return self.th.isParaWith(other.th) def __add__(self,other): return Vector(self.x+other.x, self.y+other.y) def __sub__(self,other): return Vector(self.x-other.x, self.y-other.y) def __neg__(self): return Vector(-self.x, -self.y) def __mul__(self,c): return Vector(self.x*c, self.y*c) def __rmul__(self,c): return Vector(self.x*c, self.y*c) def __div__(self,c): return Vector(self.x/c, self.y/c) def __abs__(self): return self.d def rotated(self,th): v=Vector(d=self.d, th=self.th+th) return v def rotatedWithCenter(self,th,p): return (self-p).rotated(th)+p def inprod(self,other): return self.x*other.x+self.y*other.y def outprod(self,other): return self.x*other.y-self.y*other.x def isOn(self,obj): if isinstance(obj,DirSegLine) or isinstance(obj,SegLine): return obj.ap==self or obj.bp==self or (obj.th==(self-obj.ap).th and obj.th==(obj.bp-self).th) if isinstance(obj,HalfLine): return obj.ap==self or obj.th==(self-obj.ap).th if isinstance(obj,Line): return obj.th==(self-obj.ap).th or obj.th==(obj.bp-self).th if isinstance(obj,Circle): return abs(abs(self-obj.p)-obj.d)<eps def isIn(self,obj): if isinstance(obj,Circle): return abs(self-obj.p)<obj.d def isOut(self,obj): if isinstance(obj,Circle): return abs(self-obj.p)>obj.d def __repr__(self): return "Vector("+str(self.x)+", "+str(self.y)+")" Point=Vector class DirSegLine: #directed line segment. yuukou senbun. def __init__(self,ap=None,bp=None,dv=None): if not(ap is None) and not(bp is None): self.setApBp(ap, bp) if not(ap is None) and not(dv is None): self.setApBp(ap, ap+dv) if not(bp is None) and not(dv is None): self.setApBp(bp-dv, bp) def setApBp(self,ap,bp): self.ap=ap self.bp=bp self.calcFromApBp() def calcFromApBp(self): self.dv = self.bp - self.ap self.d = abs(self.dv) self.th = self.dv.th def __eq__(self,other): return self.ap==other.ap and self.bp==other.bp def isParaWith(self,other): return self.th.isParaWith(other.th) def __add__(self,v): return DirSegLine(self.ap+v, self.bp+v) def __sub__(self,v): return DirSegLine(self.ap-v, self.bp-v) def __abs__(self): return self.d def rotated(self,th): return DirSegLine(self.ap.rotated(th), self.bp.rotated(th)) def rotatedWithCenter(self,th,p): return (self-p).rotated(th)+p def __repr__(self): return "DirSegLine(ap="+str(self.ap)+", bp="+str(self.bp)+")" class SegLine: #line segmeny. senbun. def __init__(self,ap=None,bp=None,dv=None): if not(ap is None) and not(bp is None): self.setApBp(ap, bp) if not(ap is None) and not(dv is None): self.setApBp(ap, ap+dv) if not(bp is None) and not(dv is None): self.setApBp(bp-dv, bp) def setApBp(self,ap,bp): self.ap=ap self.bp=bp self.calcFromApBp() def calcFromApBp(self): self.dv = self.bp - self.ap self.d = abs(self.dv) self.th = self.dv.th def __eq__(self,other): return (self.ap==other.ap and self.bp==other.bp) or (self.ap==other.bp and self.bp==other.ap) def isParaWith(self,other): return self.th.isParaWith(other.th) def __add__(self,v): return SegLine(self.ap+v, self.bp+v) def __sub__(self,v): return SegLine(self.ap-v, self.bp-v) def __abs__(self): return self.d def rotated(self,th): return SegLine(self.ap.rotated(th), self.bp.rotated(th)) def rotatedWithCenter(self,th,p): return (self-p).rotated(th)+p def __repr__(self): return "SegLine(ap="+str(self.ap)+", bp="+str(self.bp)+")" class HalfLine: def __init__(self,ap=None,bp=None,dv=None,th=None): if not(ap is None) and not(bp is None): self.setApBp(ap, bp) if not(ap is None) and not(dv is None): self.setApBp(ap, ap+dv) if not(bp is None) and not(dv is None): self.setApBp(bp-dv, bp) if not(ap is None) and not(th is None): self.setApBp(ap, ap+Vector(d=1,th=th)) def setApBp(self,ap,bp): self.ap=ap self.bp=bp self.calcFromApBp() def calcFromApBp(self): self.dv = self.bp - self.ap self.th = self.dv.th def __eq__(self,other): return self.ap==other.ap and self.th==other.th def isParaWith(self,other): return self.th.isParaWith(other.th) def __add__(self,v): return HalfLine(self.ap+v, self.bp+v) def __sub__(self,v): return HalfLine(self.ap-v, self.bp-v) def rotated(self,th): return HalfLine(self.ap.rotated(th), self.bp.rotated(th)) def rotatedWithCenter(self,th,p): return (self-p).rotated(th)+p def __repr__(self): return "HalfLine(ap="+str(self.ap)+", bp="+str(self.bp)+")" class Line: def __init__(self,ap=None,bp=None,dv=None,th=None): if not(ap is None) and not(bp is None): self.setApBp(ap, bp) if not(ap is None) and not(dv is None): self.setApBp(ap, ap+dv) if not(bp is None) and not(dv is None): self.setApBp(bp-dv, bp) if not(ap is None) and not(th is None): self.setApBp(ap, ap+Vector(d=1,th=th)) if not(bp is None) and not(th is None): self.setApBp(bp-Vector(d=1,th=th), bp) def setApBp(self,ap,bp): self.ap=ap self.bp=bp self.calcFromApBp() def calcFromApBp(self): self.dv = self.bp - self.ap self.th = self.dv.th def __eq__(self,other): #return ( self.ap==other.ap or self.ap==other.bp or (self.ap-other.ap).isParaWith(other.dv) ) \ # and( self.bp==other.ap or self.bp==other.bp or (self.bp-other.bp).isParaWith(other.dv) ) return self.ap.isOn(other) and self.bp.isOn(other) def isParaWith(self,other): return self.th.isParaWith(other.th) def __add__(self,v): return Line(self.ap+v, self.bp+v) def __sub__(self,v): return Line(self.ap-v, self.bp-v) def rotated(self,th): return Line(self.ap.rotated(th), self.bp.rotated(th)) def rotatedWithCenter(self,th,p): return (self-p).rotated(th)+p def __repr__(self): return "Line(ap="+str(self.ap)+", bp="+str(self.bp)+")" class Circle: def __init__(self,p,d): self.setPD(p,d) def setPD(self,p,d): self.p=p self.d=float(d) def __eq__(self,other): return self.p==other.p and abs(self.d-other.d)<eps def __add__(self,v): return Circle(self.p+v, self.d) def __sub__(self,v): return Circle(self.p-v, self.d) def rotated(self,th): return Circle(self.p.rotated(th), self.d) def rotatedWithCenter(self,th,p): return (self-p).rotated(th)+p def __repr__(self): return "Circle(p="+str(self.ap)+", d="+str(self.d)+")" class Triangle: def __init__(self,ap,bp,cp): self.setApBpCp(ap,bp,cp) def setApBpCp(self,ap,bp,cp): self.ap=ap self.bp=bp self.cp=cp self.calcFromApBpCp(ap, bp, cp) def calcFromApBpCp(self,ap,bp,cp): self.ae=SegLine(bp,cp) self.be=SegLine(cp,ap) self.ce=SegLine(ap,bp) def __eq__(self,other): return (self.ap==other.ap and self.bp==other.bp and self.cp==other.cp) \ or (self.ap==other.bp and self.bp==other.cp and self.cp==other.ap) \ or (self.ap==other.cp and self.bp==other.ap and self.cp==other.bp) def __add__(self,v): return Triangle(self.ap+v,self.bp+v,self.cp+v) def __sub__(self,v): return Triangle(self.ap-v,self.bp-v,self.cp-v) def rotated(self,th): return Triangle(self.ap.rotated(th),self.bp.rotated(th),self.cp.rotated(th)) def rotatedWithCenter(self,th,p): return (self-p).rotated(th)+p def area(self): return abs((self.cp-self.ap).outprod(self.bp-self.cp))/2 def gravityCenter(self): #juushin return (self.ap+self.bp+self.cp)/3 def innerCenter(self): #naishin return crossPoints(angleBisector(self.ae,self.be), angleBisector(self.be,self.ce))[0] def exterCenter(self): #gaishin return crossPoints(perpendicularBisector(self.ae), perpendicularBisector(self.be))[0] def orthoCenter(self): #suishin return crossPoints(perpendicular(self.ap,self.ae), perpendicular(self.bp,self.be))[0] def crossPoints(m,n): if (isinstance(m,DirSegLine) or isinstance(m,SegLine) or isinstance(m,HalfLine) or isinstance(m,Line)) \ and (isinstance(n,DirSegLine) or isinstance(n,SegLine) or isinstance(n,HalfLine) or isinstance(n,Line)): c = m.dv.outprod(n.dv) if abs(c)<eps: return [] s = n.dv.outprod(m.ap-n.ap) / c t = m.dv.outprod(n.ap-m.ap) / c if ( ((isinstance(m,DirSegLine) or isinstance(m,SegLine)) and 0<=s<=1) \ or (isinstance(m,HalfLine) and 0<=s) \ or (isinstance(m,Line)) \ )and( ((isinstance(m,DirSegLine) or isinstance(m,SegLine)) and 0<=t<=1) \ or (isinstance(m,HalfLine) and 0<=t) \ or (isinstance(m,Line)) \ ): return [m.ap+m.dv*s] if (isinstance(m,DirSegLine) or isinstance(m,SegLine) or isinstance(m,HalfLine) or isinstance(m,Line)) \ and isinstance(n,Circle): l=perpendicular(n.p, m) if l.bp.isOn(n): return [l.bp] if l.bp.isOut(n): return [] if l.bp.isIn(n): if l.dv==Vector(0,0): p1 = n.p+m.dv.e()*n.d p2 = n.p-m.dv.e()*n.d else: r=sqrt(n.d**2-l.d**2) p1 = l.bp+Vector(d=r,th=l.th+pi/2) p2 = l.bp+Vector(d=r,th=l.th-pi/2) re=[] if p1.isOn(m): re.append(p1) if p2.isOn(m): re.append(p2) return re if isinstance(m,Circle) \ and (isinstance(n,DirSegLine) or isinstance(n,SegLine) or isinstance(n,HalfLine) or isinstance(n,Line)): return crossPoints(n, m) if isinstance(m,Circle) and isinstance(n,Circle): if m.p==n.p and abs(m.d-n.d)<eps: #itchi return [] if abs( abs(m.p-n.p)-(m.d-n.d) )<eps: #naisetsu(n in m) return [(n.p*m.d-m.p*n.d)/(m.d-n.d)] if abs(m.p-n.p) < (m.d-n.d): #naihou(n in m) return [] if abs( abs(m.p-n.p)-(n.d-m.d) )<eps: #naisetsu(m in n) return [(m.p*n.d-n.p*m.d)/(n.d-m.d)] if abs(m.p-n.p) < (n.d-m.d): #naihou(n in m) return [] if abs( abs(m.p-n.p)-(m.d+n.d) )<eps: #gaisetsu return [(m.p*n.d+n.p*m.d)/(m.d+n.d)] if abs(m.p-n.p) > (m.d+n.d): #hanareteru return [] if abs(m.p-n.p) < (m.d+n.d): d = abs(m.p-n.p) x = (d**2+m.d**2-n.d**2)/(2*d) y = sqrt(m.d**2-x**2) v1 = Vector(x,y) v2 = Vector(x,-y) th = (n.p-m.p).th return [m.p+v1.rotated(th), m.p+v2.rotated(th)] def perpendicular(p,m): m=Line(m.ap,m.bp) ap=p th=m.th+pi/2 bp=crossPoints(m, Line(ap=ap,th=th))[0] return DirSegLine(ap,bp) def angleBisector(m,n): if m.isParaWith(n): return Line(ap=(m.ap+n.ap)/2,th=m.th) else: return Line(ap=crossPoints(Line(m.ap,m.bp),Line(n.ap,n.bp))[0], th = (m.th+n.th)/2) def perpendicularBisector(m): return Line(ap=(m.ap+m.bp)/2,th=m.th+pi/2) class Ufo: def __init__(self,px,py,d,vd,i): p=Vector(px,py) self.p=p self.d=d self.c=Circle(p,d) self.v=-p.e()*vd self.i=i def move(self): #genten toottaka wo kaesu if(abs(self.p)<=abs(self.v)): return True self.p=self.p+self.v self.c=self.c+self.v return False class Laser: def __init__(self,u,R): #yuukou hanni R ijou de u ni mukatte utu self.line = HalfLine(ap=neu.p.e()*R, bp=neu.p) while True: R,ul = tuple(map(int,raw_input().split())) if(R==0 and ul==0): break ignArea = Circle(Vector(0,0),R) us=[] for ui in xrange(ul): px,py,d,vd = tuple(map(int,raw_input().split())) u = Ufo(px,py,d,vd,ui) us.append(u) re=0 while True: #print "ufos moved" rus=[] #us to be removed for u in us: passed = u.move() if passed or u.p.isIn(ignArea): re+=1 rus.append(u) for u in rus: #print u.i, "removed due to it invaded inside" us.remove(u) if len(us)==0: break neu=Ufo(inf,inf,1,1,1000) for u in us: if abs(u.p)<abs(neu.p): neu=u laser = Laser(neu,R) rus=[] for u in us: if len(crossPoints(laser.line, u.c))!=0: #print u.i, "removed due to laser hit" rus.append(u) for u in rus: us.remove(u) if len(us)==0: break print re
File "/tmp/tmprlkr099i/tmp8r4y3cy6.py", line 411 print re ^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s950309135
p00204
u180584272
1426954531
Python
Python
py
Runtime Error
0
0
1126
from math import sqrt class Ufo: def __init__(self,px,py,d,vd,ui): self.pd=sqrt(px**2+py**2) self.px=float(px) self.py=float(py) self.ex=self.px/self.pd self.ey=self.py/self.pd self.d=float(d) self.vd=float(vd) self.vx=-self.vd*self.ex self.vy=-self.vd*self.ey self.i=ui def move(self): self.pd -= self.vd self.px += self.vx self.py += self.vy while True: R,ul=tuple(map(int,raw_input().split())) if(R==0 and ul==0): break us=[] for ui in xrange(ul): px,py,d,vd = tuple(map(int,raw_input().split())) u = Ufo(px,py,d,vd,ui) us.append(u) re=0 while len(us)!=0: for u in us: u.move() us.sort(key=lambda u: u.pd) for u in us[:]: if u.pd<=R: re+=1 us.remove(u) #print u.i, "due to invade" continue else: break neu=us.pop(0) #print "focus",neu.i #print neu.i,"due to hit" laserex=neu.ex laserey=neu.ey for u in us[:]: d = u.pd*abs(laserex*u.ey-laserey*u.ex) #u kara laser ni orosita suisen no nagasa if d<u.d: if u.pd*abs(laserex*u.ex+laserey*u.ey)+sqrt(u.d**2-d**2) > R: us.remove(u) #print u.i, "due to hit" print re
File "/tmp/tmplknytw3x/tmpvql48hao.py", line 58 print re ^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s302007134
p00204
u180584272
1379862533
Python
Python
py
Runtime Error
0
0
2043
from sys import stdin from math import sqrt,fabs class Ufo: def __init__(self,x,y,r,v): self.x = x*1.0 self.y = y*1.0 self.r = r*1.0 self.v = v*1.0 self.d = sqrt(x**2+y**2) self.cs = self.x / self.d self.si = self.y / self.d self.vx = -self.v*self.cs self.vy = -self.v*self.si self.migigawa = (self.x > 0) def __str__(self): return "ufo x = " + str(self.x) + ", y = " + str(self.y) + ", r = " + str(self.r) + ", v = " + str(self.v) def invaded(self): global R return (self.d<= R) def oneMinMove(self): self.x += self.vx self.y += self.vy self.d -= self.v class Laser(): def __init__(self,cs,si,migigawa): self.cs = cs self.si = si self.migigawa = migigawa def hit(laser,ufo): if laser.migigawa == ufo.migigawa: return (fabs(laser.si*ufo.x - laser.cs*ufo.y) <= ufo.r) else: return False def gameOneMinMove(): global ufos global gameend global inrl curInrs = [] for ufo in ufos: ufo.oneMinMove() if ufo.invaded(): curInrs.append(ufo) inrl += len(curInrs) #print str(len(curInrs)) + " ufos invaded!" for ufo in curInrs: ufos.remove(ufo) #print ufo del curInrs if ufos == []: gameend = True def setLaser(): global laser nearestUfo = ufos[0] for ufo in ufos: if nearestUfo.d > ufo.d : nearestUfo = ufo laser = Laser(nearestUfo.cs,nearestUfo.si,nearestUfo.migigawa) def fireLaser(): curDeads = [] for ufo in ufos: if hit(laser,ufo): curDeads.append(ufo) #print str(len(curDeads)) +" ufos burned!" for ufo in curDeads: ufos.remove(ufo) #print ufo del curDeads def oneLogic(): global gameend gameOneMinMove() if gameend: pass else: setLaser() fireLaser() def allLogic(): global gameend while not gameend: oneLogic() for inp in stdin: #for inp in open("input.txt"): inp = map(int,inp.split()) if len(inp) == 2: if inp == (0,0): break (R,N) = tuple(inp) ufos = [] laser = Laser(0,0,False) inrl = 0 gameend = False else: ufos.append(Ufo(inp[0],inp[1],inp[2],inp[3])) if len(ufos) == N: allLogic() print inrl
File "/tmp/tmptl4e2n_7/tmpv1c9pav0.py", line 108 print inrl ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s103894157
p00204
u180584272
1379899208
Python
Python
py
Runtime Error
0
0
2075
from sys import stdin from math import sqrt,fabs class Ufo: def __init__(self,x,y,r,v): self.x = x*1.0 self.y = y*1.0 self.r = r*1.0 self.v = v*1.0 self.d = sqrt(x**2+y**2) self.cs = self.x / self.d self.si = self.y / self.d self.vx = -self.v*self.cs self.vy = -self.v*self.si def __str__(self): return "ufo x = " + str(self.x) + ", y = " + str(self.y) + ", r = " + str(self.r) + ", v = " + str(self.v) def invaded(self): global R return (self.d<= R) def oneMinMove(self): self.x += self.vx self.y += self.vy self.d -= self.v class Laser(): def __init__(self,cs,si): self.cs = cs self.si = si def hit(laser,ufo): temp1 = ufo.r**2 - (laser.si*ufo.x - laser.cs*ufo.y)**2 if temp1 >= 0: temp2 = laser.cs*ufo.x + laser.si*ufo.y d1 = temp2 + sqrt(temp1) d2 = temp2 - sqrt(temp1) if d1>=0 or d2>=0: return True else: return False else: return False def gameOneMinMove(): global ufos global gameend global inrl curInrs = [] for ufo in ufos: ufo.oneMinMove() if ufo.invaded(): curInrs.append(ufo) inrl += len(curInrs) #print str(len(curInrs)) + " ufos invaded!" for ufo in curInrs: ufos.remove(ufo) #print ufo del curInrs if ufos == []: gameend = True def setLaser(): global laser nearestUfo = ufos[0] for ufo in ufos: if nearestUfo.d > ufo.d : nearestUfo = ufo laser = Laser(nearestUfo.cs,nearestUfo.si) def fireLaser(): curDeads = [] for ufo in ufos: if hit(laser,ufo): curDeads.append(ufo) #print str(len(curDeads)) +" ufos burned!" for ufo in curDeads: ufos.remove(ufo) #print ufo del curDeads def oneLogic(): global gameend gameOneMinMove() if gameend: pass else: setLaser() fireLaser() def allLogic(): global gameend while not gameend: oneLogic() for inp in stdin: #for inp in open("input.txt"): inp = map(int,inp.split()) if len(inp) == 2: if inp == (0,0): break (R,N) = tuple(inp) ufos = [] laser = Laser(0,0) inrl = 0 gameend = False else: ufos.append(Ufo(inp[0],inp[1],inp[2],inp[3])) if len(ufos) == N: allLogic() print inrl
File "/tmp/tmphauwevt9/tmpg_yzgyb8.py", line 109 print inrl ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s051983058
p00204
u180584272
1379900647
Python
Python
py
Runtime Error
0
0
2263
from sys import stdin from math import sqrt,fabs class Game: class Ufo: def __init__(self,x,y,r,v): self.x = x*1.0 self.y = y*1.0 self.r = r*1.0 self.v = v*1.0 self.d = sqrt(x**2+y**2) self.cs = self.x / self.d self.si = self.y / self.d self.vx = -self.v*self.cs self.vy = -self.v*self.si def __str__(self): return "ufo x = " + str(self.x) + ", y = " + str(self.y) + ", r = " + str(self.r) + ", v = " + str(self.v) def oneMinMove(self): self.x += self.vx self.y += self.vy self.d -= self.v class Laser: def __init__(self,cs,si): self.cs = cs self.si = si ufos = [] laser = Laser(0,0) gameend = False inrl = 0 def __init__(self,R): self.R = R def hit(self,laser,ufo): temp1 = ufo.r**2 - (laser.si*ufo.x - laser.cs*ufo.y)**2 if temp1 >= 0: temp2 = laser.cs*ufo.x + laser.si*ufo.y d1 = temp2 + sqrt(temp1) d2 = temp2 - sqrt(temp1) if d1>=0 or d2>=0: return True else: return False else: return False def isInvaded(self,ufo): return (ufo.d<= self.R) def gameOneMinMove(self): curInrs = [] for ufo in self.ufos: ufo.oneMinMove() if self.isInvaded(ufo): curInrs.append(ufo) self.inrl += len(curInrs) #print str(len(curInrs)) + " ufos invaded!" for ufo in curInrs: self.ufos.remove(ufo) #print ufo del curInrs if self.ufos == []: self.gameend = True def setLaser(self): nearestUfo = self.ufos[0] for ufo in self.ufos: if nearestUfo.d > ufo.d : nearestUfo = ufo self.laser = self.Laser(nearestUfo.cs,nearestUfo.si) def fireLaser(self): curDeads = [] for ufo in self.ufos: if self.hit(self.laser,ufo): curDeads.append(ufo) #print str(len(curDeads)) +" ufos burned!" for ufo in curDeads: self.ufos.remove(ufo) #print ufo del curDeads def oneLogic(self): self.gameOneMinMove() if self.gameend: pass else: self.setLaser() self.fireLaser() def allLogic(self): while not self.gameend: self.oneLogic() for inp in stdin: #for inp in open("input.txt"): inp = map(int,inp.split()) if len(inp) == 2: if inp == (0,0): break game = Game(inp[0]) N = inp[1] else: game.ufos.append(game.Ufo(inp[0],inp[1],inp[2],inp[3])) if len(game.ufos) == N: game.allLogic() print game.inrl
File "/tmp/tmpyz4xt3d0/tmpznrl1aro.py", line 106 print game.inrl ^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s995100024
p00204
u180584272
1379901428
Python
Python
py
Runtime Error
0
0
2211
from sys import stdin from math import sqrt,fabs class Ufo: def __init__(self,x,y,r,v): self.x = x*1.0 self.y = y*1.0 self.r = r*1.0 self.v = v*1.0 self.d = sqrt(x**2+y**2) self.cs = self.x / self.d self.si = self.y / self.d self.vx = -self.v*self.cs self.vy = -self.v*self.si def __str__(self): return "ufo x = " + str(self.x) + ", y = " + str(self.y) + ", r = " + str(self.r) + ", v = " + str(self.v) def oneMinMove(self): self.x += self.vx self.y += self.vy self.d -= self.v def isInvaded(self): return (self.d<= game.R) class Laser: def __init__(self,cs,si): self.cs = cs self.si = si def hit(self,ufo): temp1 = ufo.r**2 - (self.si*ufo.x - self.cs*ufo.y)**2 if temp1 >= 0: temp2 = self.cs*ufo.x + self.si*ufo.y d1 = temp2 + sqrt(temp1) d2 = temp2 - sqrt(temp1) if d1>=0 or d2>=0: return True else: return False else: return False class Game: ufos = [] laser = Laser(0,0) gameend = False inrl = 0 def __init__(self,R): self.R = R def gameOneMinMove(self): curInrs = [] for ufo in self.ufos: ufo.oneMinMove() if ufo.isInvaded(): curInrs.append(ufo) self.inrl += len(curInrs) #print str(len(curInrs)) + " ufos invaded!" for ufo in curInrs: self.ufos.remove(ufo) #print ufo del curInrs if self.ufos == []: self.gameend = True def setLaser(self): nearestUfo = self.ufos[0] for ufo in self.ufos: if nearestUfo.d > ufo.d : nearestUfo = ufo self.laser = Laser(nearestUfo.cs,nearestUfo.si) def fireLaser(self): curDeads = [] for ufo in self.ufos: if self.laser.hit(ufo): curDeads.append(ufo) #print str(len(curDeads)) +" ufos burned!" for ufo in curDeads: self.ufos.remove(ufo) #print ufo del curDeads def oneLogic(self): self.gameOneMinMove() if self.gameend: pass else: self.setLaser() self.fireLaser() def allLogic(self): while not self.gameend: self.oneLogic() for inp in stdin: #for inp in open("input.txt"): inp = map(int,inp.split()) if len(inp) == 2: if inp == (0,0): break game = Game(inp[0]) N = inp[1] else: game.ufos.append(Ufo(inp[0],inp[1],inp[2],inp[3])) if len(game.ufos) == N: game.allLogic() print game.inrl
File "/tmp/tmp5fudrkk8/tmptcabfaoc.py", line 108 print game.inrl ^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s108781852
p00204
u180584272
1379901757
Python
Python
py
Runtime Error
0
0
2204
import sys from math import sqrt,fabs class Ufo: def __init__(self,x,y,r,v): self.x = x*1.0 self.y = y*1.0 self.r = r*1.0 self.v = v*1.0 self.d = sqrt(x**2+y**2) self.cs = self.x / self.d self.si = self.y / self.d self.vx = -self.v*self.cs self.vy = -self.v*self.si def __str__(self): return "ufo x = " + str(self.x) + ", y = " + str(self.y) + ", r = " + str(self.r) + ", v = " + str(self.v) def oneMinMove(self): self.x += self.vx self.y += self.vy self.d -= self.v def isInvaded(self): return (self.d<= game.R) class Laser: def __init__(self,cs,si): self.cs = cs self.si = si def hit(self,ufo): temp1 = ufo.r**2 - (self.si*ufo.x - self.cs*ufo.y)**2 if temp1 >= 0: temp2 = self.cs*ufo.x + self.si*ufo.y d1 = temp2 + sqrt(temp1) d2 = temp2 - sqrt(temp1) if d1>=0 or d2>=0: return True else: return False else: return False class Game: ufos = [] laser = Laser(0,0) gameend = False inrl = 0 def __init__(self,R): self.R = R def gameOneMinMove(self): curInrs = [] for ufo in self.ufos: ufo.oneMinMove() if ufo.isInvaded(): curInrs.append(ufo) self.inrl += len(curInrs) #print str(len(curInrs)) + " ufos invaded!" for ufo in curInrs: self.ufos.remove(ufo) #print ufo del curInrs if self.ufos == []: self.gameend = True def setLaser(self): nearestUfo = self.ufos[0] for ufo in self.ufos: if nearestUfo.d > ufo.d : nearestUfo = ufo self.laser = Laser(nearestUfo.cs,nearestUfo.si) def fireLaser(self): curDeads = [] for ufo in self.ufos: if self.laser.hit(ufo): curDeads.append(ufo) #print str(len(curDeads)) +" ufos burned!" for ufo in curDeads: self.ufos.remove(ufo) #print ufo del curDeads def oneLogic(self): self.gameOneMinMove() if self.gameend: pass else: self.setLaser() self.fireLaser() def allLogic(self): while not self.gameend: self.oneLogic() for inp in sys.stdin: #for inp in open("input.txt"): inp = map(int,inp.split()) if len(inp) == 2: if inp == (0,0): break game = Game(inp[0]) N = inp[1] else: game.ufos.append(Ufo(inp[0],inp[1],inp[2],inp[3])) if len(game.ufos) == N: game.allLogic() print game.inrl
File "/tmp/tmph312wo69/tmpxoahb0_9.py", line 108 print game.inrl ^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s554376833
p00204
u180584272
1381653604
Python
Python
py
Runtime Error
0
0
2685
from math import sqrt,fabs class Ufo: def __init__(self,x,y,r,v): self.x = x*1.0 self.y = y*1.0 self.r = r*1.0 self.v = v*1.0 self.d = sqrt(x**2+y**2) self.cs = self.x / self.d self.si = self.y / self.d self.vx = -self.v*self.cs self.vy = -self.v*self.si def __str__(self): return "ufo x = " + str(self.x) + ", y = " + str(self.y) + ", r = " + str(self.r) + ", v = " + str(self.v) def oneMinMove(self): self.x += self.vx self.y += self.vy self.d -= self.v def isInvaded(self): return (self.d<= game.R) class Laser: def __init__(self,cs,si): self.cs = cs self.si = si def hit(self,ufo): temp1 = ufo.r**2 - (self.si*ufo.x - self.cs*ufo.y)**2 if temp1 >= 0: temp2 = self.cs*ufo.x + self.si*ufo.y d1 = temp2 + sqrt(temp1) d2 = temp2 - sqrt(temp1) if d1>=0 or d2>=0: return True else: return False else: return False class Game: ufos = [] laser = Laser(0,0) gameend = False inrl = 0 def __init__(self,R): self.R = R def gameOneMinMove(self): curInrs = [] for ufo in self.ufos: ufo.oneMinMove() if ufo.isInvaded(): curInrs.append(ufo) self.inrl += len(curInrs) #print str(len(curInrs)) + " ufos invaded!" for ufo in curInrs: self.ufos.remove(ufo) #print ufo del curInrs if self.ufos == []: self.gameend = True def setLaser(self): nearestUfo = self.ufos[0] for ufo in self.ufos: if nearestUfo.d > ufo.d : nearestUfo = ufo self.laser = Laser(nearestUfo.cs,nearestUfo.si) def fireLaser(self): curDeads = [] for ufo in self.ufos: if self.laser.hit(ufo): curDeads.append(ufo) #print str(len(curDeads)) +" ufos burned!" for ufo in curDeads: self.ufos.remove(ufo) #print ufo del curDeads def oneLogic(self): self.gameOneMinMove() if self.gameend: pass else: self.setLaser() self.fireLaser() def allLogic(self): while not self.gameend: self.oneLogic() while True: inp = map(int,raw_input().split()) if len(inp) == 2: if inp == (0,0): break game = Game(inp[0]) N = inp[1] else: game.ufos.append(Ufo(inp[0],inp[1],inp[2],inp[3])) if len(game.ufos) == N: game.allLogic() print game.inrl
File "/tmp/tmpes5i0g5t/tmph0v4dmqp.py", line 106 print game.inrl ^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s502981427
p00204
u633068244
1396550452
Python
Python
py
Runtime Error
0
0
658
def isHit(a,b,ufo): D=abs(a*ufo[0]+b*ufo[1])/int((a**2+b**2)**0.5) return True if D<=ufo[2] else False while 1: R,N=map(int,raw_input().split()) if R==0:break ufos=[map(int,raw_input().split()) for i in range(N)] for i in range(N): ufos[i].append((ufos[i][0]**2+ufos[i][1]**2)**0.5) #ufos[i]=[x,y,r,v,d] invade=0 while ufos: for i in range(len(ufos)): ufos[i][4]-=ufos[i][3] for i in range(len(ufos)-1,-1,-1): if ufos[i][4]<=R: invade+=1 ufos.pop(i) target=sorted(ufos,key=lambda i:i[4]).pop(0) a,b=target[1],-target[0] for i in range(len(ufos)-1,-1,-1): if isHit(a,b,ufos[i]): ufos.pop(i) print invade
File "/tmp/tmpcfa4h_ei/tmpm9vp4mrt.py", line 29 print invade ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s951956110
p00204
u633068244
1396550501
Python
Python
py
Runtime Error
0
0
716
def isHit(a,b,ufo): D=abs(a*ufo[0]+b*ufo[1])/int((a**2+b**2)**0.5) return True if D<=ufo[2] else False while 1: try: R,N=map(int,raw_input().split()) if R==0:break ufos=[map(int,raw_input().split()) for i in range(N)] for i in range(N): ufos[i].append((ufos[i][0]**2+ufos[i][1]**2)**0.5) #ufos[i]=[x,y,r,v,d] invade=0 while ufos: for i in range(len(ufos)): ufos[i][4]-=ufos[i][3] for i in range(len(ufos)-1,-1,-1): if ufos[i][4]<=R: invade+=1 ufos.pop(i) target=sorted(ufos,key=lambda i:i[4]).pop(0) a,b=target[1],-target[0] for i in range(len(ufos)-1,-1,-1): if isHit(a,b,ufos[i]): ufos.pop(i) print invade except SyntaxError: pass
File "/tmp/tmplkh0wvji/tmp97tm8fna.py", line 30 print invade ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s720922560
p00204
u633068244
1398078340
Python
Python
py
Runtime Error
0
0
1000
import math def isHit(a,b,ufo): if a*ufo[1]<=0 and -b*ufo[0]<=0:return False D=abs(a*ufo[0]+b*ufo[1])*ufo[4] if math.sqrt(ufo[4]**2-D**2)+math.sqrt(ufos[3]**2-D**2)<=R:return False return True if D<=ufo[2]+1e-7 else False while 1: R,N=map(int,raw_input().split()) if R==0:break ufos=[map(int,raw_input().split()) for i in range(N)] for i in range(N): #append d and calc cos,sin ufos[i].append(math.sqrt(ufos[i][0]**2+ufos[i][1]**2)) ufos[i][0]/=ufos[i][4] ufos[i][1]/=ufos[i][4] #ufos[i]=[cos,sin,r,v,d] invade=0 while ufos: # update d for i in range(len(ufos)): ufos[i][4]-=ufos[i][3] # remove ufo d<=R for i in range(len(ufos)-1,-1,-1): if ufos[i][4]<=R+1e-7: invade+=1 del ufos[i] if len(ufos)<=1:break # remove nearest ufo ufos=sorted(ufos,key=lambda i:i[4]) target=ufos.pop(0) #a=sin, b=-cos a,b=target[1],-target[0] # remove ufo that laser hits for i in range(len(ufos)-1,-1,-1): if isHit(a,b,ufos[i]): del ufos[i] print invade
File "/tmp/tmpfr9tg3vg/tmptdiexcj2.py", line 38 print invade ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s994874737
p00204
u633068244
1398078356
Python
Python
py
Runtime Error
0
0
999
import math def isHit(a,b,ufo): if a*ufo[1]<=0 and -b*ufo[0]<=0:return False D=abs(a*ufo[0]+b*ufo[1])*ufo[4] if math.sqrt(ufo[4]**2-D**2)+math.sqrt(ufo[3]**2-D**2)<=R:return False return True if D<=ufo[2]+1e-7 else False while 1: R,N=map(int,raw_input().split()) if R==0:break ufos=[map(int,raw_input().split()) for i in range(N)] for i in range(N): #append d and calc cos,sin ufos[i].append(math.sqrt(ufos[i][0]**2+ufos[i][1]**2)) ufos[i][0]/=ufos[i][4] ufos[i][1]/=ufos[i][4] #ufos[i]=[cos,sin,r,v,d] invade=0 while ufos: # update d for i in range(len(ufos)): ufos[i][4]-=ufos[i][3] # remove ufo d<=R for i in range(len(ufos)-1,-1,-1): if ufos[i][4]<=R+1e-7: invade+=1 del ufos[i] if len(ufos)<=1:break # remove nearest ufo ufos=sorted(ufos,key=lambda i:i[4]) target=ufos.pop(0) #a=sin, b=-cos a,b=target[1],-target[0] # remove ufo that laser hits for i in range(len(ufos)-1,-1,-1): if isHit(a,b,ufos[i]): del ufos[i] print invade
File "/tmp/tmpca40yn8e/tmph66v8iwg.py", line 38 print invade ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s405814786
p00204
u633068244
1398078502
Python
Python
py
Runtime Error
0
0
1024
import math def isHit(a,b,ufo): if a*ufo[1]<=0 and -b*ufo[0]<=0:return False D=abs(a*ufo[0]+b*ufo[1])*ufo[4] if D>ufo[2]: return False else: if math.sqrt(ufo[4]**2-D**2)+math.sqrt(ufo[3]**2-D**2)<=R: return False else: return True while 1: R,N=map(int,raw_input().split()) if R==0:break ufos=[map(int,raw_input().split()) for i in range(N)] for i in range(N): #append d and calc cos,sin ufos[i].append(math.sqrt(ufos[i][0]**2+ufos[i][1]**2)) ufos[i][0]/=ufos[i][4] ufos[i][1]/=ufos[i][4] #ufos[i]=[cos,sin,r,v,d] invade=0 while ufos: # update d for i in range(len(ufos)): ufos[i][4]-=ufos[i][3] # remove ufo d<=R for i in range(len(ufos)-1,-1,-1): if ufos[i][4]<=R+1e-7: invade+=1 del ufos[i] if len(ufos)<=1:break # remove nearest ufo ufos=sorted(ufos,key=lambda i:i[4]) target=ufos.pop(0) #a=sin, b=-cos a,b=target[1],-target[0] # remove ufo that laser hits for i in range(len(ufos)-1,-1,-1): if isHit(a,b,ufos[i]): del ufos[i] print invade
File "/tmp/tmpqepygr_r/tmpu_q2z4bg.py", line 43 print invade ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s795548872
p00205
u567380442
1429020507
Python
Python3
py
Runtime Error
0
0
426
from sys import stdin readline = stdin.readline R, S, P = 1, 2, 3 W, L, D = 1, 2, 3 rps = { (R, S, P):{R:D, S:D, P:D}, (R, S) :{R:W, S:L}, (S, P) :{S:W, P:L}, (R, P) :{P:W, R:L} } while True: hand = int(readline()) if hand == 0: break hands = [hand] + [int(readline()) for _ in range(4)] hand_set = tuple(sorted(set(hands))) for h in hands: print(rps[hand_set][h])
Traceback (most recent call last): File "/tmp/tmpt53_lb7a/tmp6zvd8qwp.py", line 16, in <module> hand = int(readline()) ^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: ''
s334749352
p00205
u567380442
1429020633
Python
Python3
py
Runtime Error
0
0
426
from sys import stdin readline = stdin.readline R, S, P = 1, 2, 3 W, L, D = 1, 2, 3 rps = { (R, S, P):{R:D, S:D, P:D}, (R, S) :{R:W, S:L}, (S, P) :{S:W, P:L}, (R, P) :{P:W, R:L} } while True: hand = int(readline()) if hand == 0: break hands = [hand] + [int(readline()) for _ in range(4)] hand_set = tuple(sorted(set(hands))) for h in hands: print(rps[hand_set][h])
Traceback (most recent call last): File "/tmp/tmpytp52cqn/tmpdkv6pgy4.py", line 16, in <module> hand = int(readline()) ^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: ''
s853927777
p00205
u567380442
1429020844
Python
Python3
py
Runtime Error
0
0
509
from sys import stdin readline = stdin.readline def main(): R, S, P = 1, 2, 3 W, L, D = 1, 2, 3 rps = { (R, S, P):{R:D, S:D, P:D}, (R, S) :{R:W, S:L}, (S, P) :{S:W, P:L}, (R, P) :{P:W, R:L} } while True: hand = int(readline()) if hand == 0: break hands = [hand] + [int(readline()) for _ in range(4)] hand_set = tuple(sorted(set(hands))) for h in hands: print(rps[hand_set][h]) main()
Traceback (most recent call last): File "/tmp/tmpebegte9h/tmp0lebytwu.py", line 24, in <module> main() File "/tmp/tmpebegte9h/tmp0lebytwu.py", line 17, in main hand = int(readline()) ^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: ''
s345566563
p00205
u567380442
1429020995
Python
Python3
py
Runtime Error
0
0
479
from sys import stdin readline = stdin.readline def main(): R, S, P = 1, 2, 3 W, L, D = 1, 2, 3 rps = { (R, S, P):{R:D, S:D, P:D}, (R, S) :{R:W, S:L}, (S, P) :{S:W, P:L}, (R, P) :{P:W, R:L} } while True: try: hands = [int(readline()) for _ in range(5)] except: break hand_set = tuple(sorted(set(hands))) for h in hands: print(rps[hand_set][h]) main()
s462484664
p00205
u567380442
1429065866
Python
Python3
py
Runtime Error
0
0
467
from sys import stdin readline = stdin.readline from io import StringIO readline = StringIO('''1 2 3 2 1 1 2 2 2 1 0''').readline R, S, P = 1, 2, 3 # rock, scissors, paper W, L, D = 1, 2, 3 # win, lose, draw while True: hands = [] hands.append(int(readline())) if hands[0] == 0: break for _ in range(4): hands.append(int(readline())) hands_set = tuple(sorted(set(hands))) for h in hands: print(rps[hands_set][h])
Traceback (most recent call last): File "/tmp/tmprs05i8ku/tmprz6l1ibp.py", line 31, in <module> print(rps[hands_set][h]) ^^^ NameError: name 'rps' is not defined
s181332284
p00205
u546285759
1486503591
Python
Python3
py
Runtime Error
0
0
428
while True: h1= int(input()) if h1== 0: break h2,h3,h4,h5= [int(input()) for _ in range(4)] l= [h1,h2,h3,h4,h5] if 1 and 2 and 3 in l: for _ in range(5): print("3") else: for i in range(5): if l[i]==1: print('1' if 2 in l '2') elif l[i]==2: print('1' if 3 in l '2') else: print('1' if 1 in l '2')
File "/tmp/tmp5jg15m75/tmpyf7nagpn.py", line 12 print('1' if 2 in l '2') ^^^^^^^^^^^^^ SyntaxError: expected 'else' after 'if' expression
s027372858
p00206
u104911888
1367120039
Python
Python
py
Runtime Error
0
0
238
while True: L=input() if L=0:break flag=True for i in range(1,13): M,N=map(int,raw_input().split()) L-=(M-N) if L<=0 and flag: print i flag=False else: print "NA"
File "/tmp/tmpdyv00l5t/tmp4l1wknvs.py", line 3 if L=0:break ^^^ SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
s654791786
p00207
u266872031
1422088845
Python
Python
py
Runtime Error
0
0
1860
def tansaku(cl,nc,ok,goal): #currentlocation,nonchecked,ok,goal [clx,cly]=cl for i in range(clx-1,clx+2): for j in range(cly-1,cly+2): if [i,j] in nc: nc.remove([i,j]) ok.append([i,j]) tansaku([i,j],nc,ok,goal) while(1): [boardw,boardh]=[int(x) for x in raw_input().split()] if boardw==0 and boardh==0: break else: [startx,starty]=[int(x) for x in raw_input().split()] [goalx,goaly]=[int(x) for x in raw_input().split()] blockn=int(raw_input()) blist={1:[],2:[],3:[],4:[],5:[]} startc=-1 goalc=-1 #mark location of block for i in range(blockn): [c,d,x,y]=[int(x) for x in raw_input().split()] if d: #d=1,tatenaga for xx in range(x,x+2): for yy in range(y,y+4): blist[c].append([xx,yy]) if [xx,yy]==[startx,starty]: startc=c if [xx,yy]==[goalx,goaly]: goalc=c else: for xx in range(x,x+4): for yy in range(y,y+2): blist[c].append([xx,yy]) if [xx,yy]==[startx,starty]: startc=c if [xx,yy]==[goalx,goaly]: goalc=c if startc==-1 or goalc==-1: print "NG" elif startc != goalc: print "NG" else: #check if connected cl=[startx,starty] nc=blist[c] nc.remove(cl) ok=[cl] goal=[goalx,goaly] tansaku(cl,nc,ok,goal) if goal in ok: print "OK" else: print "NG"
File "/tmp/tmpecbrebbl/tmp38jm5_vj.py", line 42 print "NG" ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s956905537
p00207
u266872031
1422089150
Python
Python
py
Runtime Error
0
0
1860
def tansaku(cl,nc,ok,goal): #currentlocation,nonchecked,ok,goal [clx,cly]=cl for i in range(clx-1,clx+2): for j in range(cly-1,cly+2): if [i,j] in nc: nc.remove([i,j]) ok.append([i,j]) tansaku([i,j],nc,ok,goal) while(1): [boardw,boardh]=[int(x) for x in raw_input().split()] if boardw==0 and boardh==0: break else: [startx,starty]=[int(x) for x in raw_input().split()] [goalx,goaly]=[int(x) for x in raw_input().split()] blockn=int(raw_input()) blist={1:[],2:[],3:[],4:[],5:[]} startc=-1 goalc=-1 #mark location of block for i in range(blockn): [c,d,x,y]=[int(x) for x in raw_input().split()] if d: #d=1,tatenaga for xx in range(x,x+2): for yy in range(y,y+4): blist[c].append([xx,yy]) if [xx,yy]==[startx,starty]: startc=c if [xx,yy]==[goalx,goaly]: goalc=c else: for xx in range(x,x+4): for yy in range(y,y+2): blist[c].append([xx,yy]) if [xx,yy]==[startx,starty]: startc=c if [xx,yy]==[goalx,goaly]: goalc=c if startc==-1 or goalc==-1: print "NG" elif startc != goalc: print "NG" else: #check if connected cl=[startx,starty] nc=blist[c] nc.remove(cl) ok=[cl] goal=[goalx,goaly] tansaku(cl,nc,ok,goal) if goal in ok: print "OK" else: print "NG"
File "/tmp/tmpkf9a7fe1/tmp9c1j8x4r.py", line 42 print "NG" ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s027564279
p00207
u266872031
1422089916
Python
Python
py
Runtime Error
0
0
1891
sys.setrecursionlimit(10000) def tansaku(cl,nc,ok,goal): #currentlocation,nonchecked,ok,goal [clx,cly]=cl for i in range(clx-1,clx+2): for j in range(cly-1,cly+2): if [i,j] in nc: nc.remove([i,j]) ok.append([i,j]) tansaku([i,j],nc,ok,goal) while(1): [boardw,boardh]=[int(x) for x in raw_input().split()] if boardw==0 and boardh==0: break else: [startx,starty]=[int(x) for x in raw_input().split()] [goalx,goaly]=[int(x) for x in raw_input().split()] blockn=int(raw_input()) blist={1:[],2:[],3:[],4:[],5:[]} startc=-1 goalc=-1 #mark location of block for i in range(blockn): [c,d,x,y]=[int(x) for x in raw_input().split()] if d: #d=1,tatenaga for xx in range(x,x+2): for yy in range(y,y+4): blist[c].append([xx,yy]) if [xx,yy]==[startx,starty]: startc=c if [xx,yy]==[goalx,goaly]: goalc=c else: for xx in range(x,x+4): for yy in range(y,y+2): blist[c].append([xx,yy]) if [xx,yy]==[startx,starty]: startc=c if [xx,yy]==[goalx,goaly]: goalc=c if startc==-1 or goalc==-1: print "NG" elif startc != goalc: print "NG" else: #check if connected cl=[startx,starty] nc=blist[c] nc.remove(cl) ok=[cl] goal=[goalx,goaly] tansaku(cl,nc,ok,goal) if goal in ok: print "OK" else: print "NG"
File "/tmp/tmpraf0yct4/tmplnpry1zd.py", line 44 print "NG" ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s466309152
p00207
u266872031
1422200778
Python
Python
py
Runtime Error
0
0
1923
import sys sys.setrecursionlimit(10000) def tansaku(cl,nc,ok,goal): #currentlocation,nonchecked,ok,goal directions=[[-1,0],[1,0],[0,-1],[0,1]] [clx,cly]=cl for dd in directions: [i,j]=[clx+dd[0],cly+dd[1]] if [i,j] in nc: nc.remove([i,j]) ok.append([i,j]) tansaku([i,j],nc,ok,goal) while(1): [boardw,boardh]=[int(x) for x in raw_input().split()] if boardw==0 and boardh==0: break else: [startx,starty]=[int(x) for x in raw_input().split()] [goalx,goaly]=[int(x) for x in raw_input().split()] blockn=int(raw_input()) blist={1:[],2:[],3:[],4:[],5:[]} startc=-1 goalc=-1 #mark location of block for i in range(blockn): [c,d,x,y]=[int(x) for x in raw_input().split()] if d: #d=1,tatenaga for xx in range(x,x+2): for yy in range(y,y+4): blist[c].append([xx,yy]) if [xx,yy]==[startx,starty]: startc=c if [xx,yy]==[goalx,goaly]: goalc=c else: for xx in range(x,x+4): for yy in range(y,y+2): blist[c].append([xx,yy]) if [xx,yy]==[startx,starty]: startc=c if [xx,yy]==[goalx,goaly]: goalc=c if startc==-1 or goalc==-1: print "NG" elif startc != goalc: print "NG" else: #check if connected cl=[startx,starty] nc=blist[c] nc.remove(cl) ok=[cl] goal=[goalx,goaly] tansaku(cl,nc,ok,goal) if goal in ok: print "OK" else: print "NG"
File "/tmp/tmpy9ob4efb/tmpkg4ae3lw.py", line 46 print "NG" ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s707903039
p00207
u266872031
1422200896
Python
Python
py
Runtime Error
0
0
1924
import sys sys.setrecursionlimit(100000) def tansaku(cl,nc,ok,goal): #currentlocation,nonchecked,ok,goal directions=[[-1,0],[1,0],[0,-1],[0,1]] [clx,cly]=cl for dd in directions: [i,j]=[clx+dd[0],cly+dd[1]] if [i,j] in nc: nc.remove([i,j]) ok.append([i,j]) tansaku([i,j],nc,ok,goal) while(1): [boardw,boardh]=[int(x) for x in raw_input().split()] if boardw==0 and boardh==0: break else: [startx,starty]=[int(x) for x in raw_input().split()] [goalx,goaly]=[int(x) for x in raw_input().split()] blockn=int(raw_input()) blist={1:[],2:[],3:[],4:[],5:[]} startc=-1 goalc=-1 #mark location of block for i in range(blockn): [c,d,x,y]=[int(x) for x in raw_input().split()] if d: #d=1,tatenaga for xx in range(x,x+2): for yy in range(y,y+4): blist[c].append([xx,yy]) if [xx,yy]==[startx,starty]: startc=c if [xx,yy]==[goalx,goaly]: goalc=c else: for xx in range(x,x+4): for yy in range(y,y+2): blist[c].append([xx,yy]) if [xx,yy]==[startx,starty]: startc=c if [xx,yy]==[goalx,goaly]: goalc=c if startc==-1 or goalc==-1: print "NG" elif startc != goalc: print "NG" else: #check if connected cl=[startx,starty] nc=blist[c] nc.remove(cl) ok=[cl] goal=[goalx,goaly] tansaku(cl,nc,ok,goal) if goal in ok: print "OK" else: print "NG"
File "/tmp/tmp9ozpn6es/tmpvqgiqd7r.py", line 46 print "NG" ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s283491950
p00207
u685815919
1473655862
Python
Python
py
Runtime Error
0
0
1112
import Queue blockpos = [[[0,0], [0,1], [1,0], [1,1], [2,0], [2,1], [3,0], [3,1]], [[0,0], [0,1], [0,2], [0,3], [1,0], [1,1], [1,2], [1,3]]] dxy = [[0,1], [1,0], [0,-1], [-1,0]] q = Queue.Queue() W, H = 0, 0 def checker(xs, ys, xg, yg, field, color): if color == 0: return False global W, H x = xs y = ys while True: if x == xg and y == yg: return True for dx, dy in dxy: if x+dx < 1 or y+dy < 1 or x+dx > H or y+dx > W: continue if field[x+dx][y+dy] == color: field[x+dx][y+dy] = 0 q.put([x+dx, y+dy]) if q.empty(): return False x, y = q.get() while True: # input W, H = map(int, raw_input().split()) if W==0 and H==0: break field = [[0 for i in range(W+1)] for j in range(H+1)] xs, ys = map(int, raw_input().split()) xg, yg = map(int, raw_input().split()) n = int(raw_input()) for i in range(n): c, d, x, y = map(int, raw_input().split()) for dx, dy in blockpos[d]: field[x+dx][y+dy] = c result = checker(xs, ys, xg, yg, field, field[xs][ys]) if result: print "OK" else: print "NG"
File "/tmp/tmpog0etb1j/tmpnsu2e_c2.py", line 42 print "OK" ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s359050434
p00207
u755162050
1474357948
Python
Python3
py
Runtime Error
0
0
1793
def block(board, y, x, direction, color): # ??? if direction == 0: for i in range(2): for j in range(4): board[x + i][y + j] = color # ??± elif direction == 1: for i in range(2): for j in range(4): board[x + j][y + i] = color def print_board(board): for i in range(len(board)): print(board[i]) def go_maze(board, s_x, s_y, g_x, g_y): place = board[s_x][s_y] if place == 0: return 'NG' x, y = s_x, s_y stack = [] while True: # print(x, y) board[x][y] = place + 1 if board[x + 1][y] == place: x += 1 stack.append((x, y)) elif board[x][y + 1] == place: y += 1 stack.append((x, y)) elif board[x - 1][y] == place: x -= 1 stack.append((x, y)) elif board[x][y - 1] == place: y -= 1 stack.append((x, y)) else: if len(stack) == 0 and board[x + 1][y] != place and board[x][y + 1] != place and board[x - 1][y] != place and board[x][y - 1] != place: return 'NG' (x, y) = stack.pop() if x == g_x and y == g_y: return 'OK' def main(): while True: w, h = map(int, input().split()) if w == 0 and h == 0: break board = [[0 for _ in range(w)] for _ in range(h)] s_x, s_y = map(int, input().split()) g_x, g_y = map(int, input().split()) for _ in range(int(input())): color, direction, x, y = map(int, input().split()) block(board, x, y, direction, color) # print_board(board) print(go_maze(board, s_y, s_x, g_y, g_x)) if __name__ == '__main__': main()
Traceback (most recent call last): File "/tmp/tmpd9nd0yj6/tmpdpyzjfbj.py", line 68, in <module> main() File "/tmp/tmpd9nd0yj6/tmpdpyzjfbj.py", line 52, in main w, h = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s176460558
p00207
u755162050
1474358116
Python
Python3
py
Runtime Error
0
0
1870
def block(board, y, x, direction, color): # ??? if direction == 0: for i in range(2): for j in range(4): board[x + i][y + j] = color # ??± elif direction == 1: for i in range(2): for j in range(4): board[x + j][y + i] = color def print_board(board): for i in range(len(board)): print(board[i]) def go_maze(board, s_x, s_y, g_x, g_y): place = board[s_x][s_y] if place == 0: return 'NG' x, y = s_x, s_y stack = [] while True: # print(x, y) board[x][y] = place + 1 if x + 1 < len(board) and board[x + 1][y] == place: x += 1 stack.append((x, y)) elif y + 1 < len(board[x]) and board[x][y + 1] == place: y += 1 stack.append((x, y)) elif x - 1 > 0 and board[x - 1][y] == place: x -= 1 stack.append((x, y)) elif y - 1 > 0 and board[x][y - 1] == place: y -= 1 stack.append((x, y)) else: if len(stack) == 0 and board[x + 1][y] != place and board[x][y + 1] != place and board[x - 1][y] != place and board[x][y - 1] != place: return 'NG' (x, y) = stack.pop() if x == g_x and y == g_y: return 'OK' def main(): while True: w, h = map(int, input().split()) if w == 0 and h == 0: break board = [[0 for _ in range(w)] for _ in range(h)] s_x, s_y = map(int, input().split()) g_x, g_y = map(int, input().split()) for _ in range(int(input())): color, direction, x, y = map(int, input().split()) block(board, x, y, direction, color) # print_board(board) print(go_maze(board, s_y, s_x, g_y, g_x)) if __name__ == '__main__': main()
Traceback (most recent call last): File "/tmp/tmpor3nnbgm/tmpim728brb.py", line 68, in <module> main() File "/tmp/tmpor3nnbgm/tmpim728brb.py", line 52, in main w, h = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s085144327
p00207
u755162050
1474358301
Python
Python3
py
Runtime Error
0
0
1878
def block(board, y, x, direction, color): # ??? if direction == 0: for i in range(2): for j in range(4): board[x + i][y + j] = color # ??± elif direction == 1: for i in range(2): for j in range(4): board[x + j][y + i] = color def print_board(board): for i in range(len(board)): print(board[i]) def go_maze(board, s_x, s_y, g_x, g_y): place = board[s_x][s_y] if place == 0: return 'NG' x, y = s_x, s_y stack = [] while True: # print(x, y) board[x][y] = place + 1 if x + 1 < len(board) and board[x + 1][y] == place: x += 1 stack.append((x, y)) elif y + 1 < len(board[x]) and board[x][y + 1] == place: y += 1 stack.append((x, y)) elif x - 1 > 0 and board[x - 1][y] == place: x -= 1 stack.append((x, y)) elif y - 1 > 0 and board[x][y - 1] == place: y -= 1 stack.append((x, y)) else: if len(stack) == 0 and board[x + 1][y] != place and board[x][y + 1] != place and board[x - 1][y] != place and board[x][y - 1] != place: return 'NG' (x, y) = stack.pop() if x == g_x and y == g_y: return 'OK' def main(): while True: w, h = map(int, input().split()) if w == 0 and h == 0: break board = [[0 for _ in range(w + 1)] for _ in range(h + 1)] s_x, s_y = map(int, input().split()) g_x, g_y = map(int, input().split()) for _ in range(int(input())): color, direction, x, y = map(int, input().split()) block(board, x, y, direction, color) # print_board(board) print(go_maze(board, s_y, s_x, g_y, g_x)) if __name__ == '__main__': main()
Traceback (most recent call last): File "/tmp/tmpowszft2e/tmpklt_1hez.py", line 68, in <module> main() File "/tmp/tmpowszft2e/tmpklt_1hez.py", line 52, in main w, h = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s340151461
p00207
u755162050
1474359222
Python
Python3
py
Runtime Error
0
0
1878
def block(board, y, x, direction, color): # ??? if direction == 0: for i in range(2): for j in range(4): board[x + i][y + j] = color # ??± elif direction == 1: for i in range(2): for j in range(4): board[x + j][y + i] = color def print_board(board): for i in range(len(board)): print(board[i]) def go_maze(board, s_x, s_y, g_x, g_y): place = board[s_x][s_y] if place == 0: return 'NG' x, y = s_x, s_y stack = [] while True: # print(x, y) board[x][y] = place + 1 if x + 1 < len(board) and board[x + 1][y] == place: x += 1 stack.append((x, y)) elif y + 1 < len(board[x]) and board[x][y + 1] == place: y += 1 stack.append((x, y)) elif x - 1 > 0 and board[x - 1][y] == place: x -= 1 stack.append((x, y)) elif y - 1 > 0 and board[x][y - 1] == place: y -= 1 stack.append((x, y)) else: if len(stack) == 0 and board[x + 1][y] != place and board[x][y + 1] != place and board[x - 1][y] != place and board[x][y - 1] != place: return 'NG' (x, y) = stack.pop() if x == g_x and y == g_y: return 'OK' def main(): while True: w, h = map(int, input().split()) if w == 0 and h == 0: break board = [[0 for _ in range(w + 1)] for _ in range(h + 1)] s_x, s_y = map(int, input().split()) g_x, g_y = map(int, input().split()) for _ in range(int(input())): color, direction, x, y = map(int, input().split()) block(board, x, y, direction, color) # print_board(board) print(go_maze(board, s_y, s_x, g_y, g_x)) if __name__ == '__main__': main()
Traceback (most recent call last): File "/tmp/tmply2wnamv/tmpuf4z79h0.py", line 68, in <module> main() File "/tmp/tmply2wnamv/tmpuf4z79h0.py", line 52, in main w, h = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s736452641
p00207
u755162050
1474371486
Python
Python3
py
Runtime Error
0
0
1823
""" Created by Jieyi on 9/20/16. """ def block(board, w, h, direction, color): # horizontal. if direction == 0: for i in range(2): for j in range(4): board[h + i][w + j] = color # vertical. elif direction == 1: for i in range(2): for j in range(4): board[h + j][w + i] = color def print_board(board): for i in range(len(board)): print(board[i]) def go_maze(board, s_w, s_h, g_w, g_h): place = board[s_h][s_w] if place == 0: return 'NG' w, h = s_w, s_h stack = [] while True: board[h][w] = place + 1 if board[h + 1][w] == place: h += 1 stack.append((w, h)) elif board[h][w + 1] == place: w += 1 stack.append((w, h)) elif board[h - 1][w] == place: h -= 1 stack.append((w, h)) elif board[h][w - 1] == place: w -= 1 stack.append((w, h)) else: if len(stack) == 0 and board[h + 1][w] != place and board[h][w + 1] != place and board[h - 1][w] != place and board[h][w - 1] != place: return 'NG' (w, h) = stack.pop() if w == g_w and h == g_h: return 'OK' def main(): while True: w, h = map(int, input().split()) if w == 0 and h == 0: break board = [[0 for _ in range(w)] for _ in range(h)] s_w, s_h = map(int, input().split()) g_w, g_h = map(int, input().split()) for _ in range(int(input())): color, direction, w, h = map(int, input().split()) block(board, w, h, direction, color) # print_board(board) print(go_maze(board, s_w, s_h, g_w, g_h)) if __name__ == '__main__': main()
Traceback (most recent call last): File "/tmp/tmp7e9628zd/tmplgd11e6n.py", line 70, in <module> main() File "/tmp/tmp7e9628zd/tmplgd11e6n.py", line 54, in main w, h = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s560678933
p00207
u755162050
1474371672
Python
Python3
py
Runtime Error
0
0
1900
""" Created by Jieyi on 9/20/16. """ def block(board, w, h, direction, color): # horizontal. if direction == 0: for i in range(2): for j in range(4): board[h + i][w + j] = color # vertical. elif direction == 1: for i in range(2): for j in range(4): board[h + j][w + i] = color def print_board(board): for i in range(len(board)): print(board[i]) def go_maze(board, s_w, s_h, g_w, g_h): place = board[s_h][s_w] if place == 0: return 'NG' w, h = s_w, s_h stack = [] while True: board[h][w] = place + 1 if h + 1 < len(board) and board[h + 1][w] == place: h += 1 stack.append((w, h)) elif w + 1 < len(board[h]) and board[h][w + 1] == place: w += 1 stack.append((w, h)) elif h - 1 > 0 and board[h - 1][w] == place: h -= 1 stack.append((w, h)) elif w - 1 > 0 and board[h][w - 1] == place: w -= 1 stack.append((w, h)) else: if len(stack) == 0 and board[h + 1][w] != place and board[h][w + 1] != place and board[h - 1][w] != place and board[h][w - 1] != place: return 'NG' (w, h) = stack.pop() if w == g_w and h == g_h: return 'OK' def main(): while True: w, h = map(int, input().split()) if w == 0 and h == 0: break board = [[0 for _ in range(w)] for _ in range(h)] s_w, s_h = map(int, input().split()) g_w, g_h = map(int, input().split()) for _ in range(int(input())): color, direction, w, h = map(int, input().split()) block(board, w, h, direction, color) # print_board(board) print(go_maze(board, s_w, s_h, g_w, g_h)) if __name__ == '__main__': main()
Traceback (most recent call last): File "/tmp/tmp1ny19u9p/tmpkcpmyitq.py", line 70, in <module> main() File "/tmp/tmp1ny19u9p/tmpkcpmyitq.py", line 54, in main w, h = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s825320478
p00207
u227162786
1490017062
Python
Python3
py
Runtime Error
0
0
985
import numpy as np def dfs(x, y, m, v, W, H, xg, yg): ''' ''' v[y, x] = True for dx, dy in [(-1, 0), (1, 0), (0, -1), (0, 1)]: nx = x + dx ny = y + dy if nx in range(W) and ny in range(H) and m[ny, nx] == m[y, x] and v[ny, nx] == False: dfs(nx, ny, m, v, W, H, xg, yg) while True: H, W = list(map(int, input().split())) xs, ys = list(map(lambda x: int(x)-1, input().split())) xg, yg = list(map(lambda x: int(x)-1, input().split())) n = int(input()) m = np.array([[0 for _ in range(W)] for __ in range(H)]) v = np.array([[False for _ in range(W)] for __ in range(H)]) for _ in range(n): c, d, x, y = list(map(int, input().split())) x -= 1 y -= 1 if d == 0: m[y:y+2, x:x+4] = c else: m[y:y+4, x:x+2] = c dfs(xs, ys, m, v, W, H, xg, yg) if v[yg, xg]: print('OK') else: print('NG') # print(m) # print(v)
Traceback (most recent call last): File "/tmp/tmp3zclo7q0/tmpc8i4it2e.py", line 14, in <module> H, W = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s057962999
p00207
u227162786
1490017352
Python
Python3
py
Runtime Error
0
0
994
import numpy as np def dfs(x, y, m, v, W, H, xg, yg): ''' ''' v[y, x] = True for dx, dy in [(-1, 0), (1, 0), (0, -1), (0, 1)]: nx = x + dx ny = y + dy if nx in range(W) and ny in range(H) and m[ny, nx] == m[y, x] and v[ny, nx] == False: dfs(nx, ny, m, v, W, H, xg, yg) while True: H, W = list(map(int, input().split())) if H == 0 and W == 0: break xs, ys = list(map(lambda x: int(x)-1, input().split())) xg, yg = list(map(lambda x: int(x)-1, input().split())) n = int(input()) m = np.array([[0 for _ in range(W)] for __ in range(H)]) v = np.array([[False for _ in range(W)] for __ in range(H)]) for _ in range(n): c, d, x, y = list(map(int, input().split())) x -= 1 y -= 1 if d == 0: m[y:y+2, x:x+4] = c else: m[y:y+4, x:x+2] = c dfs(xs, ys, m, v, W, H, xg, yg) if v[yg, xg]: print('OK') else: print('NG')
Traceback (most recent call last): File "/tmp/tmpj6vct7h0/tmp88ocigr7.py", line 14, in <module> H, W = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s397279338
p00207
u227162786
1490017361
Python
Python3
py
Runtime Error
0
0
994
import numpy as np def dfs(x, y, m, v, W, H, xg, yg): ''' ''' v[y, x] = True for dx, dy in [(-1, 0), (1, 0), (0, -1), (0, 1)]: nx = x + dx ny = y + dy if nx in range(W) and ny in range(H) and m[ny, nx] == m[y, x] and v[ny, nx] == False: dfs(nx, ny, m, v, W, H, xg, yg) while True: H, W = list(map(int, input().split())) if H == 0 and W == 0: break xs, ys = list(map(lambda x: int(x)-1, input().split())) xg, yg = list(map(lambda x: int(x)-1, input().split())) n = int(input()) m = np.array([[0 for _ in range(W)] for __ in range(H)]) v = np.array([[False for _ in range(W)] for __ in range(H)]) for _ in range(n): c, d, x, y = list(map(int, input().split())) x -= 1 y -= 1 if d == 0: m[y:y+2, x:x+4] = c else: m[y:y+4, x:x+2] = c dfs(xs, ys, m, v, W, H, xg, yg) if v[yg, xg]: print('OK') else: print('NG')
Traceback (most recent call last): File "/tmp/tmpbgled29q/tmpytokwfr8.py", line 14, in <module> H, W = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s963806860
p00207
u227162786
1490017757
Python
Python3
py
Runtime Error
0
0
993
import numpy as np def dfs(x, y, m, v, W, H, xg, yg): ''' ''' v[y, x] = True for dx, dy in [(-1, 0), (1, 0), (0, -1), (0, 1)]: nx = x + dx ny = y + dy if nx in range(W) and ny in range(H) and m[ny, nx] == m[y, x] and v[ny, nx] == False: dfs(nx, ny, m, v, W, H, xg, yg) while True: H, W = list(map(int, input().split())) if H == 0 and W == 0: break xs, ys = list(map(lambda x: int(x)-1, input().split())) xg, yg = list(map(lambda x: int(x)-1, input().split())) n = int(input()) m = np.array([[0 for _ in range(W)] for __ in range(H)]) v = np.array([[False for _ in range(W)] for __ in range(H)]) for _ in range(n): c, d, x, y = list(map(int, input().split())) x -= 1 y -= 1 if d == 0: m[y:y+2, x:x+4] = c else: m[y:y+4, x:x+2] = c dfs(xs, ys, m, v, W, H, xg, yg) if v[yg, xg]: print('OK') else: print('NG')
Traceback (most recent call last): File "/tmp/tmpzoxecgc_/tmph5pa9hsw.py", line 14, in <module> H, W = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s719740976
p00207
u227162786
1490018601
Python
Python3
py
Runtime Error
0
0
1085
def dfs(x, y, m, v, W, H, xg, yg): ''' ''' v[y][x] = True for dx, dy in [(-1, 0), (1, 0), (0, -1), (0, 1)]: nx = x + dx ny = y + dy if nx in range(W) and ny in range(H) and m[ny][nx] == m[y][x] and v[ny][nx] == False: dfs(nx, ny, m, v, W, H, xg, yg) while True: H, W = list(map(int, input().split())) if H == 0 and W == 0: break xs, ys = list(map(lambda x: int(x)-1, input().split())) xg, yg = list(map(lambda x: int(x)-1, input().split())) n = int(input()) m = [[0 for _ in range(W)] for __ in range(H)] v = [[False for _ in range(W)] for __ in range(H)] for _ in range(n): c, d, x, y = list(map(int, input().split())) x -= 1 y -= 1 if d == 0: for y in range(2): for x in range(4): m[y][x] = c else: for y in range(4): for x in range(2): m[y][x] = c dfs(xs, ys, m, v, W, H, xg, yg) if v[yg][xg]: print('OK') else: print('NG')
Traceback (most recent call last): File "/tmp/tmpnhxggdcg/tmp8jn_uo8m.py", line 12, in <module> H, W = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line