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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s700485097 | p02235 | u888871392 | 1509534912 | Python | Python | py | Runtime Error | 0 | 0 | 479 | from collections import defaultdict
def lcs(x, y):
dp = [defaultdict(int) for _ in range(len(x) + 1)]
dp[0] = [0]*(len(y) + 1)
for i in range(len(x)):
for j in range(len(y)):
if x[i] == y[j]:
dp[i + 1][j + 1] = dp[i][j] + 1
else:
dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j])
return dp[len(x)][len(y)]
N = int(input())
for i in range(N):
x = input()
y = input()
print(lcs(x, y)) | Traceback (most recent call last):
File "/tmp/tmpxksxj_vf/tmpl38v1jiy.py", line 16, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s848948582 | p02235 | u626266743 | 1511275958 | Python | Python3 | py | Runtime Error | 0 | 0 | 564 | def Ics(X, Y):
m = len(X)
n = len(Y)
maxl = 0
for i in range(m + 1):
c[i][0] = 0
for j in range(1, n + 1):
c[0][j] = 0
for i in range(1, m + 1):
for j in range(1, n + 1):
if(X[i] == Y[j]):
c[i][j] = c[i - 1][j - 1] + 1
else:
c[i][j] = max(c[i][j - 1], c[i - 1][j])
maxl = max(maxl, c[i][j])
return maxl
q = int(input())
t = []
for i in range(n):
s1 = input().rstrip()
s2 = input().rstrip()
t.append(lcs(s1, s2))
print(*t, sep="\n") | Traceback (most recent call last):
File "/tmp/tmppgmt4tcm/tmp112k5yva.py", line 18, in <module>
q = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s938802831 | p02235 | u626266743 | 1511276115 | Python | Python3 | py | Runtime Error | 0 | 0 | 573 | def Ics(X, Y):
m = len(X)
n = len(Y)
maxl = 0
for i in range(m + 1):
c[i][0] = 0
for j in range(1, n + 1):
c[0][j] = 0
for i in range(1, m + 1):
for j in range(1, n + 1):
if(X[i] == Y[j]):
c[i][j] = c[i - 1][j - 1] + 1
else:
c[i][j] = max(c[i][j - 1], c[i - 1][j])
maxl = max(maxl, c[i][j])
return maxl
q = int(input().rstrip())
t = []
for i in range(n):
s1 = input().rstrip()
s2 = input().rstrip()
t.append(lcs(s1, s2))
print(*t, sep="\n") | Traceback (most recent call last):
File "/tmp/tmphk86xfup/tmp1q1qael_.py", line 18, in <module>
q = int(input().rstrip())
^^^^^^^
EOFError: EOF when reading a line
| |
s116690703 | p02235 | u626266743 | 1511276327 | Python | Python3 | py | Runtime Error | 0 | 0 | 582 | def Ics(X, Y):
m = len(X)
n = len(Y)
maxl = 0
for i in range(m + 1):
c[i][0] = 0
for j in range(1, n + 1):
c[0][j] = 0
for i in range(1, m + 1):
for j in range(1, n + 1):
if(X[i] == Y[j]):
c[i][j] = c[i - 1][j - 1] + 1
elif(c[i - 1][j] <= c[i][j - 1]):
c[i][j] = c[i- 1][j]
maxl = max(maxl, c[i][j])
return maxl
q = int(input().rstrip())
t = []
for i in range(n):
s1 = input().rstrip()
s2 = input().rstrip()
t.append(lcs(s1, s2))
print(*t, sep="\n") | Traceback (most recent call last):
File "/tmp/tmptiig3opc/tmpo6vozusx.py", line 18, in <module>
q = int(input().rstrip())
^^^^^^^
EOFError: EOF when reading a line
| |
s855211150 | p02235 | u626266743 | 1511276425 | Python | Python3 | py | Runtime Error | 0 | 0 | 582 | def Ics(X, Y):
m = len(X)
n = len(Y)
maxl = 0
for i in range(m + 1):
c[i][0] = 0
for j in range(1, n + 1):
c[0][j] = 0
for i in range(1, m + 1):
for j in range(1, n + 1):
if(X[i] == Y[j]):
c[i][j] = c[i - 1][j - 1] + 1
elif(c[i - 1][j] <= c[i][j - 1]):
c[i][j] = c[i- 1][j]
maxl = max(maxl, c[i][j])
return maxl
q = int(input().rstrip())
t = []
for i in range(n):
s1 = input().rstrip()
s2 = input().rstrip()
t.append(Ics(s1, s2))
print(*t, sep="\n") | Traceback (most recent call last):
File "/tmp/tmpvwwoleh9/tmp7_n_t573.py", line 18, in <module>
q = int(input().rstrip())
^^^^^^^
EOFError: EOF when reading a line
| |
s677718479 | p02235 | u626266743 | 1511276786 | Python | Python3 | py | Runtime Error | 0 | 0 | 612 | def Ics(X, Y):
m = len(X)
n = len(Y)
maxl = 0
c = (m + 1)*[(n + 1)*[0]]
for i in range(m + 1):
c[i][0] = 0
for j in range(1, n + 1):
c[0][j] = 0
for i in range(1, m + 1):
for j in range(1, n + 1):
if(X[i] == Y[j]):
c[i][j] = c[i - 1][j - 1] + 1
elif(c[i - 1][j] <= c[i][j - 1]):
c[i][j] = c[i- 1][j]
maxl = max(maxl, c[i][j])
return maxl
q = int(input().rstrip())
t = []
for i in range(n):
s1 = input().rstrip()
s2 = input().rstrip()
t.append(Ics(s1, s2))
print(*t, sep="\n") | Traceback (most recent call last):
File "/tmp/tmp3iceloq4/tmplha118lo.py", line 19, in <module>
q = int(input().rstrip())
^^^^^^^
EOFError: EOF when reading a line
| |
s460126271 | p02235 | u626266743 | 1511276998 | Python | Python3 | py | Runtime Error | 0 | 0 | 415 | def Ics(X, Y):
m = len(X)
n = len(Y)
c1, c2 = [0] * (n + 1)
for i in range(m):
d = X[i]
for j in range(n):
if d == Y[j]:
c1[j+1] = c2[j] + 1
elif c1[j+1] < c1[j]:
c1[j+1] = c1[j]
return c1[-1]
q = int(input().rstrip())
t = []
for i in range(n):
s1 = input().rstrip()
s2 = input().rstrip()
t.append(Ics(s1, s2))
print(*t, sep="\n") | Traceback (most recent call last):
File "/tmp/tmpnfslbdtm/tmp5dx5xl62.py", line 14, in <module>
q = int(input().rstrip())
^^^^^^^
EOFError: EOF when reading a line
| |
s412172591 | p02235 | u626266743 | 1511277104 | Python | Python3 | py | Runtime Error | 0 | 0 | 446 | def Ics(X, Y):
m = len(X)
n = len(Y)
c1 = [0] * (n + 1)
c2 = [0] * (n + 1)
for i in range(m):
d = X[i]
for j in range(n):
if (d == Y[j]):
c1[j + 1] = c2[j] + 1
elif (c1[j + 1] < c1[j]):
c1[j + 1] = c1[j]
return (c1[-1])
q = int(input().rstrip())
t = []
for i in range(n):
s1 = input().rstrip()
s2 = input().rstrip()
t.append(Ics(s1, s2))
print(*t, sep="\n") | Traceback (most recent call last):
File "/tmp/tmp9k_2lwms/tmp7v5uknso.py", line 15, in <module>
q = int(input().rstrip())
^^^^^^^
EOFError: EOF when reading a line
| |
s205199715 | p02235 | u424457654 | 1511281106 | Python | Python3 | py | Runtime Error | 0 | 0 | 396 | def Ics(x, y):
a = len(x)
b = len(y)
c1 = [0] * (b + 1)
for i in range(a):
d = x[i]
c2 = c1[:]
for j in range(n):
if d == y[j]:
c1[j + 1] = c2[j] + 1
elif c1[j + 1] < c1[j]:
c1[j + 1] = c1[j]
return c1[-1]
q = int(input())
for k in range(q):
x = input()
y = input()
print(Ics(x, y)) | Traceback (most recent call last):
File "/tmp/tmpf7jaxx2l/tmpk4bws5zl.py", line 16, in <module>
q = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s123653638 | p02235 | u424457654 | 1511281337 | Python | Python3 | py | Runtime Error | 0 | 0 | 462 | def Ics(x, y):
a = len(x)
b = len(y)
c1 = [0] * (b + 1)
for i in range(a):
d = x[i]
c2 = c1[:]
for j in range(n):
if d == y[j]:
c1[j + 1] = c2[j] + 1
elif c1[j + 1] < c1[j]:
c1[j + 1] = c1[j]
return (c1[-1])
q = int(input().rstrip())
r = []
for k in range(q):
s1 = input().rstrip()
s2 = input().rstrip()
r.append(Ics(s1, s2))
print(*r, sep = "\n") | Traceback (most recent call last):
File "/tmp/tmp9lm_gog9/tmpjaafb_hx.py", line 16, in <module>
q = int(input().rstrip())
^^^^^^^
EOFError: EOF when reading a line
| |
s664097753 | p02235 | u424457654 | 1511281470 | Python | Python3 | py | Runtime Error | 0 | 0 | 460 | def Ics(x, y):
a = len(x)
b = len(y)
c1 = [0] * (b + 1)
for i in range(a):
d = x[i]
c2 = c1[:]
for j in range(n):
if d == y[j]:
c1[j + 1] = c2[j] + 1
elif c1[j + 1] < c1[j]:
c1[j + 1] = c1[j]
return c1[-1]
q = int(input().rstrip())
r = []
for k in range(q):
s1 = input().rstrip()
s2 = input().rstrip()
r.append(Ics(s1, s2))
print(*r, sep = "/n") | Traceback (most recent call last):
File "/tmp/tmpff55v30f/tmpnkkz50wg.py", line 16, in <module>
q = int(input().rstrip())
^^^^^^^
EOFError: EOF when reading a line
| |
s161077569 | p02235 | u845643816 | 1511319664 | Python | Python3 | py | Runtime Error | 0 | 0 | 394 | q = int(input())
t = []
for i in range(q):
X = input()
Y = input()
m = len(X)
n = len(Y)
c1 = [0] * (n + 1)
for i in range(m):
d = X[i]
c2 = c1[:]
for j in range(n):
if (d == Y[j]):
c1[j + 1] = c2[j] + 1
elif (c1[j + 1] < c1[j]):
c1[j + 1] = c1[j]
return (c1[-1])
print(Ics(s1, s2)) | File "/tmp/tmp1_zjrwe3/tmpsbi5x222.py", line 17
return (c1[-1])
^^^^^^^^^^^^^^^
SyntaxError: 'return' outside function
| |
s751703647 | p02235 | u405454529 | 1515716577 | Python | Python3 | py | Runtime Error | 30 | 5608 | 426 | q = int(input())
X = ""
Y = ""
memo = [[]]
def LCS(x, y):
if (x < 0) or (y < 0):
return 0
elif memo[x][y] != -1:
return memo[x][y]
else:
memo[x][y] = max(LCS(x-1,y), LCS(x,y-1), LCS(x-1, y-1)+int(X[x] == Y[y]))
return memo[x][y]
for c in range(q):
X = input()
Y = input()
memo = [[-1 for j in range(len(Y))] for i in range(len(X))]
print(LCS(len(X)-1, len(Y)-1))
| Traceback (most recent call last):
File "/tmp/tmp0jauxdky/tmprm1z6wly.py", line 1, in <module>
q = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s249076440 | p02235 | u405454529 | 1515717938 | Python | Python3 | py | Runtime Error | 0 | 0 | 682 | import sys
import functools as ft
sys.setrecursionlimit(10000)
q = int(input())
X = ""
Y = ""
memo = [[]]
def print_memo() :
for x in range(len(X)):
print(ft.reduce(lambda x,y: x + str(y) + "\t" ,memo[x], ""))
def LCS(x, y):
if (x < 0) or (y < 0):
return 0
elif memo[x][y] != -1:
return memo[x][y]
elif X[x] == Y[y]:
memo[x][y] = LCS(x-1, y-1) + 1
return memo[x][y]
elif:
memo[x][y] = max(LCS(x-1,y), LCS(x,y-1))
return memo[x][y]
for c in range(q):
X = input()
Y = input()
memo = [[-1 for j in range(len(Y))] for i in range(len(X))]
print(LCS(len(X)-1, len(Y)-1))
#print_memo()
| File "/tmp/tmpkyzlu592/tmpvuj6x24f.py", line 22
elif:
^
SyntaxError: invalid syntax
| |
s131623474 | p02235 | u426534722 | 1518879906 | Python | Python3 | py | Runtime Error | 3350 | 6000 | 726 | from collections import defaultdict
q = int(input())
for _ in range(q):
x = input()
y = input()
len_x = len(x)
len_y = len(y)
if len_x < len_y:
len_x, len_y = len_y, len_x
x, y = y, x
c = defaultdict(list)
for i, s in enumerate(x):
c[s].append(i)
ans = 0
def g(li, a):
for i in li:
if i >= a:
return i
return -1
def f(x_i, y_i, cnt):
if x_i >= len_x or y_i >= len_y:
global ans
if ans < cnt:
ans = cnt
return
f(x_i, y_i + 1, cnt)
s = g(c[y[y_i]], x_i)
if s != -1:
f(s + 1, y_i + 1, cnt + 1)
f(0, 0, 0)
print(ans)
| Traceback (most recent call last):
File "/tmp/tmp2k9z0byr/tmpmgpx52o1.py", line 2, in <module>
q = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s099941849 | p02235 | u426534722 | 1518881418 | Python | Python3 | py | Runtime Error | 0 | 0 | 808 | import sys
sys.setrecursionlimit(200000)
from collections import defaultdict
from bisect import bisect_left, bisect, insort_left, insort
q = int(input())
for _ in range(q):
x = input()
y = input()
len_x = len(x)
len_y = len(y)
if len_x < len_y:
len_x, len_y = len_y, len_x
x, y = y, x
c = defaultdict(list)
for i, s in enumerate(x):
c[s].append(i)
ans = 0
@lru_cache(maxsize=1000)
def f(x_i, y_i, cnt):
if x_i >= len_x or y_i >= len_y:
global ans
if ans < cnt:
ans = cnt
return
f(x_i, y_i + 1, cnt)
s = bisect_left(c[y[y_i]], x_i)
if s < len(c[y[y_i]]) and c[y[y_i]][s] < len_x:
f(c[y[y_i]][s] + 1, y_i + 1, cnt + 1)
f(0, 0, 0)
print(ans)
| Traceback (most recent call last):
File "/tmp/tmp9ypikq9m/tmpg7nh2xqq.py", line 5, in <module>
q = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s859323771 | p02235 | u150984829 | 1519774218 | Python | Python3 | py | Runtime Error | 0 | 0 | 227 | a=[]
for _ in[0]*int(input()):
X,z=input(),[]
for y in input():
s=i=0
for k in z:
t=X.find(y,s)+1
if t<1:break
if t<k:z[i]=t
s=k;i+=1
else:
t=X.find(y,s)+1
if t:z+=[t]
a+=[len(z)]
print('\n'.join(a))
| Traceback (most recent call last):
File "/tmp/tmpqrvm86f0/tmpw78j3ssq.py", line 2, in <module>
for _ in[0]*int(input()):
^^^^^^^
EOFError: EOF when reading a line
| |
s223282248 | p02235 | u150984829 | 1519780132 | Python | Python3 | py | Runtime Error | 0 | 0 | 200 | i=input
for _ in[0]*int(i()):
X,z=i(),[]
for y in i():
s=i=0
for k in z:
t=X.find(y,s)+1
if t<1:break
if t<k:z[i]=t
s=k;i+=1
else:
t=X.find(y,s)+1
if t:z+=[t]
print(len(z))
| Traceback (most recent call last):
File "/tmp/tmp0vc1av31/tmpmi_2rf_l.py", line 2, in <module>
for _ in[0]*int(i()):
^^^
EOFError: EOF when reading a line
| |
s066448039 | p02235 | u048595360 | 1522041633 | Python | Python3 | py | Runtime Error | 0 | 0 | 432 | def solver(str_1 ,str_2):
dp = [[0] * (len(str_2) + 1) for i in range(len(str_1) + 1)]
for r in range(len(str_2)):
for c in range(len(str_1)):
if str_2[r] == str_1[c]:
dp[r + 1][c + 1] = dp[r][c] + 1
else:
dp[r + 1][c + 1] = max(dp[r + 1][c], dp[r][c + 1])
return dp[len(str_2)][len(str_1)]
n = int(input())
for _ in range(n):
str_1 = input()
str_2 = input()
print(solver(str_1, str_2))
| Traceback (most recent call last):
File "/tmp/tmp0v8c7003/tmpoih4qrvy.py", line 11, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s902519859 | p02235 | u048595360 | 1522041653 | Python | Python3 | py | Runtime Error | 0 | 0 | 432 | def solver(str_1 ,str_2):
dp = [[0] * (len(str_2) + 1) for i in range(len(str_1) + 1)]
for r in range(len(str_2)):
for c in range(len(str_1)):
if str_2[r] == str_1[c]:
dp[r + 1][c + 1] = dp[r][c] + 1
else:
dp[r + 1][c + 1] = max(dp[r + 1][c], dp[r][c + 1])
return dp[len(str_2)][len(str_1)]
n = int(input())
for _ in range(n):
str_1 = input()
str_2 = input()
print(solver(str_1, str_2))
| Traceback (most recent call last):
File "/tmp/tmpxufpn84t/tmpi_27vi6p.py", line 11, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s187949661 | p02235 | u912143677 | 1522154147 | Python | Python3 | py | Runtime Error | 70 | 5608 | 354 | n = int(input())
c = [[0, 0]for i in range(n)]
def lcs(x, y):
xlen = len(x)
ylen = len(y)
if xlen == 0 or ylen == 0:
return 0
elif x[xlen-1] == y[ylen-1]:
return lcs(x[:-1], y[:-1]) + 1
else:
return max(lcs(x, y[:-1]), lcs(x[:-1], y))
for i in range(n):
x = input()
y = input()
print(lcs(x, y))
| Traceback (most recent call last):
File "/tmp/tmpcgl0jt2l/tmp2vtfkkdf.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s800801424 | p02235 | u912143677 | 1522154257 | Python | Python3 | py | Runtime Error | 70 | 5604 | 323 | n = int(input())
def lcs(x, y):
xlen = len(x)
ylen = len(y)
if xlen == 0 or ylen == 0:
return 0
elif x[xlen-1] == y[ylen-1]:
return lcs(x[:-1], y[:-1]) + 1
else:
return max(lcs(x, y[:-1]), lcs(x[:-1], y))
for i in range(n):
x = input()
y = input()
print(lcs(x, y))
| Traceback (most recent call last):
File "/tmp/tmpa9pyjoaq/tmp6oh4at26.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s574972941 | p02235 | u255317651 | 1525439272 | Python | Python3 | py | Runtime Error | 0 | 0 | 620 | # -*- coding: utf-8 -*-
"""
Created on Fri May 4 20:33:37 2018
ALDS1_10_C
@author: maezawa
"""
def longest(x, y):
m = len(x)
n = len(y)
c = [[0 for _ in range(m+1)] for _ in range(n+1)]
for i in range(m):
for j in range(n):
print(i,j)
if x[i] == y[j]:
c[i][j] = c[i-1][j-1] + 1
elif c[i-1][j] >= c[i][j-1]:
c[i][j] = c[i-1][j]
else:
c[i][j] = c[i][j-1]
return c[m-1][n-1]
q = int(input())
for i in range(q):
x = input()
y = input()
print(longest(x, y))
| Traceback (most recent call last):
File "/tmp/tmpgtskdo1r/tmp09oaxa6e.py", line 25, in <module>
q = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s835094222 | p02235 | u255317651 | 1525439476 | Python | Python3 | py | Runtime Error | 0 | 0 | 621 | # -*- coding: utf-8 -*-
"""
Created on Fri May 4 20:33:37 2018
ALDS1_10_C
@author: maezawa
"""
def longest(x, y):
m = len(x)
n = len(y)
c = [[0 for _ in range(m+1)] for _ in range(n+1)]
for i in range(m):
for j in range(n):
#print(i,j)
if x[i] == y[j]:
c[i][j] = c[i-1][j-1] + 1
elif c[i-1][j] >= c[i][j-1]:
c[i][j] = c[i-1][j]
else:
c[i][j] = c[i][j-1]
return c[m-1][n-1]
q = int(input())
for i in range(q):
x = input()
y = input()
print(longest(x, y))
| Traceback (most recent call last):
File "/tmp/tmpmdcazjc5/tmpsylshvm_.py", line 25, in <module>
q = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s354413675 | p02235 | u255317651 | 1525480931 | Python | Python3 | py | Runtime Error | 0 | 0 | 594 | # -*- coding: utf-8 -*-
"""
Created on Fri May 4 20:33:37 2018
ALDS1_10_C Using Numpy
@author: maezawa
"""
import numpy as np
def longest(x, y):
m = len(x)
n = len(y)
maxl = 0
c = np.zeros((m+1, n+1), dtype=int)
for i in range(m):
for j in range(n):
#print(i,j)
if x[i] == y[j]:
c[i, j] = c[i-1, j-1] + 1
else:
c[i, j] = max(c[i-1, j], c[i, j-1])
maxl = max(maxl, c[i, j])
return maxl
q = int(input())
for i in range(q):
x = input()
y = input()
print(longest(x, y))
| Traceback (most recent call last):
File "/tmp/tmpjdeiqn08/tmpoj93i6is.py", line 25, in <module>
q = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s433488273 | p02235 | u011621222 | 1526178857 | Python | Python3 | py | Runtime Error | 0 | 0 | 662 | def lcs(s1,s2):
if len(str_a) == 0 or len(str_b) == 0:
return 0
dp = [[0 for _ in range(len(str_b) + 1)] for _ in range(len(str_a) + 1)]
for i in range(1, len(str_a) + 1):
for j in range(1, len(str_b) + 1):
if str_a[i-1] == str_b[j-1]:
dp[i][j] = dp[i-1][j-1] + 1
else:
dp[i][j] = max([dp[i-1][j], dp[i][j-1]])
#print ("length of LCS is :",dp[len(str_a)][len(str_b)])
return dp[len(str_a)][len(str_b)]
#print (find_lcseque('abdfg','abcdfg') )
n=int(input())
for i in range(n):
s1=input()
s2=input()
#rt=find_lcseque(s1,s2)
rt=lcs(s1,s2)
print(rt)
| File "/tmp/tmpvn02ldrz/tmp_i3l95a3.py", line 12
return dp[len(str_a)][len(str_b)]
^
IndentationError: unindent does not match any outer indentation level
| |
s927945907 | p02235 | u684241248 | 1528617554 | Python | Python3 | py | Runtime Error | 0 | 0 | 621 | # -*- coding: utf-8 -*-
import numpy as np
def lcs_sol(x, y):
n = len(x)
m = len(y)
dp = np.zeros((n + 1) * (m + 1)).reshape(n + 1, m + 1)
for i in range(1, n + 1):
for j in range(1, m + 1):
if x[i - 1] == y[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
return dp[n][m]
if __name__ == '__main__':
import sys
q = int(sys.stdin.readline().strip())
for i in range(q):
x = sys.stdin.readline().strip()
y = sys.stdin.readline().strip()
print(lcs_sol(x, y))
| Traceback (most recent call last):
File "/tmp/tmpdshlmi8t/tmpxx6g88k0.py", line 21, in <module>
q = int(sys.stdin.readline().strip())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s270890668 | p02235 | u684241248 | 1528617643 | Python | Python3 | py | Runtime Error | 0 | 0 | 632 | # -*- coding: utf-8 -*-
import numpy as np
def lcs_sol(x, y):
n = len(x)
m = len(y)
dp = np.zeros((n + 1) * (m + 1), dtype=int).reshape(n + 1, m + 1)
for i in range(1, n + 1):
for j in range(1, m + 1):
if x[i - 1] == y[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
return dp[n][m]
if __name__ == '__main__':
import sys
q = int(sys.stdin.readline().strip())
for i in range(q):
x = sys.stdin.readline().strip()
y = sys.stdin.readline().strip()
print(lcs_sol(x, y))
| Traceback (most recent call last):
File "/tmp/tmph_5gewp6/tmpr_ny20k1.py", line 21, in <module>
q = int(sys.stdin.readline().strip())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s580171297 | p02235 | u684241248 | 1528617849 | Python | Python3 | py | Runtime Error | 0 | 0 | 19 | import numpy as np
| ||
s976110507 | p02235 | u684241248 | 1528629298 | Python | Python3 | py | Runtime Error | 30 | 6668 | 577 | # -*- coding: utf-8 -*-
import functools
def lcs(x, y):
n = len(x)
m = len(y)
return rec(x, y, n, m)
@functools.lru_cache(maxsize=None)
def rec(x, y, i, j):
if i == 0 or j == 0:
return 0
elif x[i - 1] == y[j - 1]:
return rec(x, y, i - 1, j - 1) + 1
else:
return max(rec(x, y, i, j - 1), rec(x, y, i - 1, j))
if __name__ == '__main__':
import sys
q = int(sys.stdin.readline().strip())
for i in range(q):
x = sys.stdin.readline().strip()
y = sys.stdin.readline().strip()
print(lcs(x, y))
| Traceback (most recent call last):
File "/tmp/tmpee87tlib/tmpgb806pm0.py", line 23, in <module>
q = int(sys.stdin.readline().strip())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s998771346 | p02235 | u559106458 | 1529415749 | Python | Python3 | py | Runtime Error | 80 | 5680 | 636 | def lcs(str1,str2):
c=[[0 for _ in range(100)] for _ in range(100)]
m=len(str1)
n=len(str2)
maxl=0
str1=" "+str1
str2=" "+str2
i=1
j=1
while(i<=m):
while(j<=n):
if(str1[i]==str2[j]):
c[i][j]=c[i-1][j-1]+1
# print(c[i][j])
else:
c[i][j]=max(c[i-1][j],c[i][j-1])
maxl=max(maxl,c[i][j])
j+=1
i+=1
j=0
return maxl
def main():
n=int(input())
i=0
while(i<n):
str1=str(input())
str2=str(input())
print(int(lcs(str1,str2)))
i+=1
main()
| Traceback (most recent call last):
File "/tmp/tmpqj7cmpe0/tmprmrkp9xw.py", line 34, in <module>
main()
File "/tmp/tmpqj7cmpe0/tmprmrkp9xw.py", line 26, in main
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s593806261 | p02235 | u559106458 | 1529415854 | Python | Python3 | py | Runtime Error | 4460 | 14432 | 638 | def lcs(str1,str2):
c=[[0 for _ in range(1000)] for _ in range(1000)]
m=len(str1)
n=len(str2)
maxl=0
str1=" "+str1
str2=" "+str2
i=1
j=1
while(i<=m):
while(j<=n):
if(str1[i]==str2[j]):
c[i][j]=c[i-1][j-1]+1
# print(c[i][j])
else:
c[i][j]=max(c[i-1][j],c[i][j-1])
maxl=max(maxl,c[i][j])
j+=1
i+=1
j=0
return maxl
def main():
n=int(input())
i=0
while(i<n):
str1=str(input())
str2=str(input())
print(int(lcs(str1,str2)))
i+=1
main()
| Traceback (most recent call last):
File "/tmp/tmpe4wyr0ml/tmpu4slq5gp.py", line 34, in <module>
main()
File "/tmp/tmpe4wyr0ml/tmpu4slq5gp.py", line 26, in main
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s612406946 | p02235 | u007270338 | 1530033329 | Python | Python3 | py | Runtime Error | 0 | 0 | 693 | #coding:utf-8
from copy import deepcopy
import numpy as np
n = int(input())
def lcs(X,Y):
m = len(X)
n = len(Y)
c = [[False for i in range(n+1)] for j in range(m+1)]
for i in range(m+1):
c[i][0] = 0
for i in range(n+1):
c[0][i] = 0
for i in range(1,m+1):
for j in range(1,n+1):
if X[i-1] == Y[j-1]:
c[i][j] = c[i-1][j-1] + 1
elif c[i-1][j] >= c[i][j-1]:
c[i][j] = c[i-1][j]
else:
c[i][j] = c[i][j-1]
c = np.array(c)
return c[m][n]
for i in range(n):
A = input()
B = input()
a = lcs(A,B)
print(a)
| Traceback (most recent call last):
File "/tmp/tmpow6b732o/tmp_dxbbxxt.py", line 4, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s433710150 | p02235 | u007270338 | 1530033349 | Python | Python3 | py | Runtime Error | 0 | 0 | 673 | #coding:utf-8
from copy import deepcopy
import numpy as np
n = int(input())
def lcs(X,Y):
m = len(X)
n = len(Y)
c = [[False for i in range(n+1)] for j in range(m+1)]
for i in range(m+1):
c[i][0] = 0
for i in range(n+1):
c[0][i] = 0
for i in range(1,m+1):
for j in range(1,n+1):
if X[i-1] == Y[j-1]:
c[i][j] = c[i-1][j-1] + 1
elif c[i-1][j] >= c[i][j-1]:
c[i][j] = c[i-1][j]
else:
c[i][j] = c[i][j-1]
return c[m][n]
for i in range(n):
A = input()
B = input()
a = lcs(A,B)
print(a)
| Traceback (most recent call last):
File "/tmp/tmpl6mlfi0o/tmpfud13dya.py", line 4, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s456540928 | p02235 | u912237403 | 1375391581 | Python | Python | py | Runtime Error | 0 | 0 | 632 | import sys
def longestcommonsubsequence(seq1, seq2):
a,b = len(seq1)+1, len(seq2)+1
length = [[0 for i in range(b)] for j in range(a)]
for i in range(a):
e1=seq[i-1]
for j in range(b):
if i==0 or j==0:
length[i][j]=0
else:
if e1 == seq2[j-1]:
length[i][j] = length[i-1][j-1] + 1
else:
length[i][j] = max(length[i-1][j], length[i][j-1])
return length[a-1][b-1]
n = input()
for i2 in range(n):
seq1 = raw_input()
seq2 = raw_input()
print longestcommonsubsequence(seq1, seq2) | File "/tmp/tmp3ht9u3ua/tmp1acui44d.py", line 24
print longestcommonsubsequence(seq1, seq2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s542085878 | p02235 | u912237403 | 1375396116 | Python | Python | py | Runtime Error | 0 | 0 | 531 | import sys
def longestcommonsubsequence():
seq1 = raw_input()
seq2 = raw_input()
a,b = len(seq1), len(seq2)
x1 = [0 for i in range(b+1)]
for i in range(a+1):
e1 = seq[i]
x2 = x1
x1 = [0 for i2 in range(b+1)]
tmp = 0
for j in range(b):
if e1 == seq2[j]:
tmp = x2[j] + 1
else:
tmp = max(x2[j+1], tmp)
x1[j+1] = tmp
return x1[-1]
n = input()
for i2 in range(n):
print longestcommonsubsequence() | File "/tmp/tmp7a2vcuov/tmp54bigtio.py", line 25
print longestcommonsubsequence()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s753603973 | p02235 | u912237403 | 1375396139 | Python | Python | py | Runtime Error | 0 | 0 | 532 | import sys
def longestcommonsubsequence():
seq1 = raw_input()
seq2 = raw_input()
a,b = len(seq1), len(seq2)
x1 = [0 for i in range(b+1)]
for i in range(a+1):
e1 = seq1[i]
x2 = x1
x1 = [0 for i2 in range(b+1)]
tmp = 0
for j in range(b):
if e1 == seq2[j]:
tmp = x2[j] + 1
else:
tmp = max(x2[j+1], tmp)
x1[j+1] = tmp
return x1[-1]
n = input()
for i2 in range(n):
print longestcommonsubsequence() | File "/tmp/tmpkh4yww9n/tmpun478gj7.py", line 25
print longestcommonsubsequence()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s083855363 | p02237 | u467648242 | 1545836878 | Python | Python | py | Runtime Error | 0 | 0 | 395 | n = int(input())
in_list = []
for i in range(n):
in_list.append(list(map(int, input().split())))
matrices = [[0 for _ in range(n)] for _ in range(n)]
for i in range(n):
inp = in_list[i]
u = inp[0]
k = inp[1]
for j in range(k):
m = inp[j+2]
matrices[i][m-1] = 1
for i in range(n):
s = ""
for m in matrices[i]:
s += str(m) + " "
print(s)
| Traceback (most recent call last):
File "/tmp/tmp4_xh1upr/tmphhd4cgv4.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s860356704 | p02237 | u821080069 | 1559308125 | Python | Python3 | py | Runtime Error | 0 | 0 | 282 | import numpy as np
n = int(input())
result = np.array([[0]*4]*4)
for _ in range(n):
inp = list(map(int, input().split()))
u, k = inp[0], inp[1]
v = inp[2:]
if k != 0:
for vv in v:
result[u-1][vv-1] = 1
result = list(result)
for i in range(n):
print(*result[i])
| Traceback (most recent call last):
File "/tmp/tmpk224yz6n/tmpk2vnll5d.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s034653215 | p02237 | u580607517 | 1422810826 | Python | Python | py | Runtime Error | 0 | 0 | 293 | # 入力
n = int(raw_input())
# 隣接行列を格納する配列
x = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
seq = map(int,raw_input().split())
tmp = seq[0]-1
n2 = seq[1]
if n2!=0:
for e in seq[2:]:
x[tmp][e-1]=1
for i in range(n):
print " ".join(map(str,x[i])) | File "/tmp/tmp1schuz04/tmpo7dw0sqr.py", line 13
print " ".join(map(str,x[i]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s927277326 | p02237 | u731976921 | 1453861457 | Python | Python | py | Runtime Error | 0 | 0 | 312 | N = int(raw_input())
A = [0] * N
for i in range(N):
A[i] = [0] * N
for line in sys.stdin:
values = line.split()
u = int(values[0]) - 1
k = int(values[1])
nodes = values[2:]
for i in range(int(k)):
v = int(nodes[i]) - 1
A[u][v] = 1
for i in range(N):
print " ".join([str(x) for x in A[i]]) | File "/tmp/tmpt9imhnsx/tmp14b7uwa3.py", line 16
print " ".join([str(x) for x in A[i]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s904497552 | p02237 | u984009739 | 1467858090 | Python | Python3 | py | Runtime Error | 0 | 0 | 229 | n = int(input())
v = [[0] * n for _ in range(n)]
for i in range(0,n):
l = list(map(int,input().split()))
u = l[0]
k = l[1]
for j in l[2:]:
v[i-1][j-1]=1
for i in range(n):
for j in range(n):
print(v[i][j]+" ") | Traceback (most recent call last):
File "/tmp/tmpv4l6ixim/tmprnoyarup.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s430441552 | p02237 | u112247126 | 1488245486 | Python | Python3 | py | Runtime Error | 0 | 0 | 425 | import sys
class Graph:
def __init__(self, nodes={}):
self.nodes = nodes
n = int(input())
G = Graph()
for line in sys.stdin:
numList = line.split()
G.nodes[numList[1]] = numList[1:]
for _ in range(n):
out = ''
for i in range(n):
if i + 1 != n:
out += '0 ' if i + 1 in G.nodes[1] else '1 '
else:
out += '0' if i + 1 in G.nodes[1] else '1'
print(out) | Traceback (most recent call last):
File "/tmp/tmpd1_yyoar/tmpzvqgtbpp.py", line 9, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s239993358 | p02237 | u112247126 | 1488246255 | Python | Python3 | py | Runtime Error | 0 | 0 | 463 | import sys
class Graph:
def __init__(self, nodes={}):
self.nodes = nodes
n = int(input())
G = Graph()
for line in sys.stdin:
numList = line.split()
G.nodes[int(numList[0])] = list(map(int, numList[1:]))
for node in range(n):
out = ''
for adj in range(n):
if adj + 1 != n:
out += '1 ' if adj + 1 in G.nodes[node] else '0 '
else:
out += '1' if adj + 1 in G.nodes[node] else '0'
print(out) | Traceback (most recent call last):
File "/tmp/tmpsy7th_ze/tmplqwsz4hr.py", line 9, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s788996748 | p02237 | u112247126 | 1488247116 | Python | Python3 | py | Runtime Error | 0 | 0 | 640 | import sys
class Graph:
def __init__(self, nodes={}):
self.nodes = nodes
def printAdjMatrix(self):
# assuming that nodes' indices are 1,2,3,...,n
n = len(self.nodes)
for node in range(n):
out = ''
for adj in range(n):
if adj + 1 != n:
out += '1 ' if adj + 1 in G.nodes[node + 1] else '0 '
else:
out += '1' if adj + 1 in G.nodes[node + 1] else '0'
print(out)
n = int(input())
G = Graph()
for line in sys.stdin:
numList = list(map(int, line.split()))
G.nodes[numList[0]] = list(numList[2:])
G.printAdjMatrix() | File "/tmp/tmp7e5n89aa/tmpzfvlfs39.py", line 11
out = ''
^
IndentationError: expected an indented block after 'for' statement on line 10
| |
s971994089 | p02237 | u228579910 | 1489587192 | Python | Python3 | py | Runtime Error | 0 | 0 | 215 | n = int(input())
g = [[0] * n for _ in range(n)]
while n:
l = list(map(int, input().split()))
column_g = g[l[0] - 1]
for i in l[2:]:
column_g[i-1] = 1
n -= 1
for v in column_g:
print(*v) | Traceback (most recent call last):
File "/tmp/tmphxum2bl3/tmpv9j6jesp.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s876518793 | p02237 | u067677727 | 1498879857 | Python | Python3 | py | Runtime Error | 0 | 0 | 381 | def main():
n = int(input())
adj = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
tmp = list(map(int, input().split()))
u = tmp[0]
u = u -1
k = tmp[1]
v = tmp[2:]
for j in range(k):
adj[u][v[j]-1] = 1
for i in range(n):
print(" ".join(list(map(str, adj[i]))))
for i in adj:
print(*i)
if __name__ == "__main__":
main() | File "/tmp/tmplmqkqze9/tmp3zz_ooct.py", line 7
tmp = list(map(int, input().split()))
TabError: inconsistent use of tabs and spaces in indentation
| |
s960247879 | p02237 | u067677727 | 1498879872 | Python | Python3 | py | Runtime Error | 0 | 0 | 381 | def main():
n = int(input())
adj = [[0 for i in range(n)] for j in range(n)]
for i in range(n):
tmp = list(map(int, input().split()))
u = tmp[0]
u = u -1
k = tmp[1]
v = tmp[2:]
for j in range(k):
adj[u][v[j]-1] = 1
for i in range(n):
print(" ".join(list(map(str, adj[i]))))
for i in adj:
print(*i)
if __name__ == "__main__":
main() | File "/tmp/tmpitbmz6sn/tmp52gevgn7.py", line 7
tmp = list(map(int, input().split()))
TabError: inconsistent use of tabs and spaces in indentation
| |
s376027062 | p02237 | u798803522 | 1509546848 | Python | Python3 | py | Runtime Error | 0 | 0 | 260 | v_num = int(input())
adjacent = [[0 for n in range(v_num)] for m in range(v_num)]
for _ in range(v_num):
inp = (int(n) for n in input().split(" "))
for i in inp[2:]:
adjacent[inp[0] - 1][i - 1] = 1
for i in range(v_num):
print(*adjacent[i]) | Traceback (most recent call last):
File "/tmp/tmpr8amryp6/tmptybyq31h.py", line 1, in <module>
v_num = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s561036459 | p02237 | u626266743 | 1511867614 | Python | Python3 | py | Runtime Error | 0 | 0 | 212 | n = int(input()))
for i in range(n):
M = [0] * n
u = list(map(int, input().split()))
v = u[0]
k = u[0]
for j in range(k):
M[u - 1][v - 1] = 1
for i in range M:
print(i, sep = " ") | File "/tmp/tmpsmkghaq1/tmp8m3iput0.py", line 1
n = int(input()))
^
SyntaxError: unmatched ')'
| |
s573996055 | p02237 | u626266743 | 1511867736 | Python | Python3 | py | Runtime Error | 0 | 0 | 275 | n = int(input()))
for i in range(n):
M = [0] * n
u = list(map(int, input().split()))
v = u[0]
k = u[1]
for j in range(k):
M[u - 1][v - 1] = 1
for i in range n:
for j in range n:
if (j):
print(" ")
print(M[i-1][j-1] | File "/tmp/tmpms2ktgoi/tmpzjb4qlew.py", line 1
n = int(input()))
^
SyntaxError: unmatched ')'
| |
s481706961 | p02237 | u626266743 | 1511867863 | Python | Python3 | py | Runtime Error | 0 | 0 | 180 | n = int(input()))
for i in range(n):
M = [0] * n
u = list(map(int, input().split()))
v = u[0]
for j in u[2:]:
M[u - 1][v - 1] = 1
for i in M:
print(*i) | File "/tmp/tmpjwow46tv/tmp5_2pkh1k.py", line 1
n = int(input()))
^
SyntaxError: unmatched ')'
| |
s203354590 | p02237 | u626266743 | 1511867957 | Python | Python3 | py | Runtime Error | 0 | 0 | 196 | n = int(input()))
M = [[0] * n for i in range(n)]
for i in range(n):
u = list(map(int, input().split()))
v = u[0]
for j in u[2:]:
M[u - 1][v - 1] = 1
for i in M:
print(*i) | File "/tmp/tmp1y2hiztr/tmphq7r8rfs.py", line 1
n = int(input()))
^
SyntaxError: unmatched ')'
| |
s050934406 | p02237 | u626266743 | 1511868072 | Python | Python3 | py | Runtime Error | 0 | 0 | 180 | n = int(input()))
for i in range(n):
M = [0] * n
u = list(map(int, input().split()))
v = u[0]
for j in u[2:]:
M[v - 1][j - 1] = 1
for i in M:
print(*i) | File "/tmp/tmpuix58mpi/tmpv__wrbwp.py", line 1
n = int(input()))
^
SyntaxError: unmatched ')'
| |
s024521528 | p02237 | u626266743 | 1511868099 | Python | Python3 | py | Runtime Error | 0 | 0 | 192 | n = int(input()))
M = [[0] * n in range (n)]
for i in range(n):
u = list(map(int, input().split()))
v = u[0]
for j in u[2:]:
M[v - 1][j - 1] = 1
for i in M:
print(*i) | File "/tmp/tmp1ph_bh9d/tmp00qmj9vj.py", line 1
n = int(input()))
^
SyntaxError: unmatched ')'
| |
s985440387 | p02237 | u626266743 | 1511868120 | Python | Python3 | py | Runtime Error | 0 | 0 | 197 | n = int(input()))
M = [[0] * n for i in range (n)]
for i in range(n):
u = list(map(int, input().split()))
v = u[0]
for j in u[2:]:
M[v - 1][j - 1] = 1
for i in M:
print(*i) | File "/tmp/tmp5do7qwr2/tmpmypr_t3z.py", line 1
n = int(input()))
^
SyntaxError: unmatched ')'
| |
s985135090 | p02237 | u626266743 | 1511868219 | Python | Python3 | py | Runtime Error | 0 | 0 | 198 | n = int(input())
M = [[0] * n for i in range???(n)]
for i in range(n):
u = list(map(int, input().split()))
v = u[0]
for j in u[2:]:
M[v - 1][j - 1] = 1
for i in M:
print(*i) | File "/tmp/tmp626cfghc/tmpf6lc8cc9.py", line 2
M = [[0] * n for i in range???(n)]
^
SyntaxError: invalid syntax
| |
s263009834 | p02237 | u845643816 | 1512123350 | Python | Python3 | py | Runtime Error | 0 | 0 | 204 | n = int(input())
a = [[0]*n for i in range(n)]
for i in range(n):
v = list(map(int, input().split()))
for j in range(v[1]):
a[u - 1][v[2 + j] - 1] = 1
for i in range(n):
print(*a[i]) | Traceback (most recent call last):
File "/tmp/tmp_cf1q07l/tmpbjt2qcn2.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s404244171 | p02237 | u150984829 | 1519960775 | Python | Python3 | py | Runtime Error | 0 | 0 | 94 | N=int(input())
for _ in[0]*N:
r=[0]*N
for i in input().split()[2:]:a[int(i)-1]=1
print(*a)
| Traceback (most recent call last):
File "/tmp/tmpylialusv/tmpfw9it9cs.py", line 1, in <module>
N=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s126760029 | p02237 | u733945366 | 1529482673 | Python | Python3 | py | Runtime Error | 0 | 0 | 364 | n=int(input());
G=[[0 for i in range(n)]for j in range(n)]
for i in range(n):
list=[int(m) for m in input().split()]
u=list[0]
k=list[1]
for j in range(2,len(list)):
v=list[j]
G[u-1][v-1]=1
for i in range(n):
for j in range(n):
print(G[i][j],end="")
if j!=len(g[i])-1:
print(" ",end="")
print()
| Traceback (most recent call last):
File "/tmp/tmp2bd132rf/tmpcfs419n_.py", line 1, in <module>
n=int(input());
^^^^^^^
EOFError: EOF when reading a line
| |
s412726750 | p02237 | u055885332 | 1529483767 | Python | Python3 | py | Runtime Error | 0 | 0 | 370 | #16D8101014F KurumeRyunosuke 2018/6/20
import numpy as np
n=int(input())
ls=np.zeros((n,n))
for i in range(n):
tmp=input().split()
#print(tmp)
for j in range(int(tmp[1])):
#print("*")
ls[i][int(tmp[j+2])-1]=1
for i in range(n):
for j in range(n):
if(j!=n-1):
print(int(ls[i][j]), end=' ')
else:
print(int(ls[i][j]))
| Traceback (most recent call last):
File "/tmp/tmpelg4pwh2/tmpuslvd_hj.py", line 3, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s938013599 | p02237 | u055885332 | 1529483877 | Python | Python3 | py | Runtime Error | 0 | 0 | 370 | #16D8101014F KurumeRyunosuke 2018/6/20
import numpy as np
n=int(input())
ls=np.zeros((n,n))
for i in range(n):
tmp=input().split()
#print(tmp)
for j in range(int(tmp[1])):
#print("*")
ls[i][int(tmp[j+2])-1]=1
for i in range(n):
for j in range(n):
if(j!=n-1):
print(int(ls[i][j]), end=' ')
else:
print(int(ls[i][j]))
| Traceback (most recent call last):
File "/tmp/tmpj8masviw/tmp6itb7ucq.py", line 3, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s481016918 | p02237 | u055885332 | 1529483982 | Python | Python3 | py | Runtime Error | 0 | 0 | 302 | import numpy as np
n=int(input())
ls=np.zeros((n,n))
for i in range(n):
tmp=input().split()
for j in range(int(tmp[1])):
ls[i][int(tmp[j+2])-1]=1
for i in range(n):
for j in range(n):
if(j!=n-1):
print(int(ls[i][j]), end=' ')
else:
print(int(ls[i][j]))
| Traceback (most recent call last):
File "/tmp/tmpyuhh2xyd/tmpiqcd1_sn.py", line 2, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s711756938 | p02237 | u836567931 | 1529485500 | Python | Python3 | py | Runtime Error | 0 | 0 | 372 | n=int(input())
arr = [[0 for i in range(n)] for j in range(n)]
#print(arr)
for i in range(0,n):
l=raw_input().split()
if(int(l[1])>=1):
x=int(l[0])
y=int(l[1])
p=len(l)
d=0
while(2+d<p):
z=int(l[2+d])
#print(x,y,z)
arr[x-1][z-1]=1
#print(arr)
d=d+1
print(arr)
| Traceback (most recent call last):
File "/tmp/tmpba4oozl7/tmpjh6ahk1a.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s990038056 | p02237 | u836567931 | 1529485532 | Python | Python3 | py | Runtime Error | 0 | 0 | 309 | n=int(input())
arr = [[0 for i in range(n)] for j in range(n)]
for i in range(0,n):
l=raw_input().split()
if(int(l[1])>=1):
x=int(l[0])
y=int(l[1])
p=len(l)
d=0
while(2+d<p):
z=int(l[2+d])
arr[x-1][z-1]=1
d=d+1
print(arr)
| Traceback (most recent call last):
File "/tmp/tmp3tofq7fu/tmpahltaepy.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s428058995 | p02237 | u836567931 | 1529485587 | Python | Python3 | py | Runtime Error | 0 | 0 | 309 | n=int(input())
arr = [[0 for i in range(n)] for j in range(n)]
for i in range(0,n):
l=raw_input().split()
if(int(l[1])>=1):
x=int(l[0])
y=int(l[1])
p=len(l)
d=0
while(2+d<p):
z=int(l[2+d])
arr[x-1][z-1]=1
d=d+1
print(arr)
| Traceback (most recent call last):
File "/tmp/tmp1yomvq2f/tmpf1g0dyr2.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s273231636 | p02237 | u573915636 | 1529729999 | Python | Python3 | py | Runtime Error | 0 | 0 | 171 | import numpy as np
n=int(input())
g=np.zeros((n,n),dtype=np.int)
for i in range(n):
s=list(map(int,input().split()))
for j in range(s[1]):
g[s[0]][s[2+j]]+=1
print(g)
| Traceback (most recent call last):
File "/tmp/tmp514voyg0/tmpmw0a5sgq.py", line 2, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s902870000 | p02237 | u573915636 | 1529730025 | Python | Python3 | py | Runtime Error | 0 | 0 | 171 | import numpy as np
n=int(input())
g=np.zeros((n,n),dtype=np.int)
for i in range(n):
s=list(map(int,input().split()))
for j in range(s[1]):
g[s[0]][s[2+j]]+=1
print(g)
| Traceback (most recent call last):
File "/tmp/tmp728c_r4e/tmpgxn5c9ky.py", line 2, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s598041383 | p02237 | u573915636 | 1529732449 | Python | Python3 | py | Runtime Error | 0 | 0 | 175 | import numpy as np
n=int(input())
g=np.zeros((n,n),dtype=np.int)
for i in range(n):
s=list(map(int,input().split()))
for j in range(s[1]):
g[s[0]-1][s[2+j]-1]+=1
print(g)
| Traceback (most recent call last):
File "/tmp/tmp_rjrqimb/tmpgec5j_hr.py", line 2, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s409006348 | p02237 | u782850731 | 1380689315 | Python | Python | py | Runtime Error | 0 | 0 | 382 | #include <stdio.h>
int main(void) {
int num, i, k, u;
int v[101];
const char *fmt;
scanf("%d", &num);
for (i = 0; i < num; i++) {
for (k = 1; k <= num; k++) {
v[k] = 0;
}
scanf("%d %d", &u, &k);
while (k--) {
scanf("%d", &u);
v[u] = 1;
}
fmt = "%d";
for (k = 1; k <= num; k++) {
printf(fmt, v[k]);
fmt = " %d";
}
putchar('\n');
}
return 0;
} | File "/tmp/tmpo1nryktq/tmpih2bvgix.py", line 2
int main(void) {
^^^^
SyntaxError: invalid syntax
| |
s508724003 | p02238 | u279605379 | 1534728448 | Python | Python3 | py | Runtime Error | 0 | 0 | 401 | def dfs(n):
global t
S[n] = t
DP[n]=1
for i in A[n][2:]:
if not DP[i]:
t += 1
dfs(i)
t += 1
F[n] = t
n = int(input())
d = deque()
A = [0]*(n+1)
S = [0]*(n+1)
F = [0]*(n+1)
DP = [0]*(n+1)
for i in range(n):
A[i+1] = [int(i) for i in input().split()]
t = 1
dfs(1)
for i in range(1,n+1):
tmp = "{} {} {}".format(i,S[i],F[i])
print(tmp)
| Traceback (most recent call last):
File "/tmp/tmpz8xgv24_/tmph_ev2f8w.py", line 11, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s030734551 | p02238 | u007270338 | 1535596462 | Python | Python3 | py | Runtime Error | 0 | 0 | 657 | #coding: utf-8
n = int(input())
color = ["white" for i in range(n)]
d = [[] for i in range(n)]
global t
t = 0
M = [[False for i in range(n)] for j in range(n)]
for i in range(n):
data = list(map(int,input().split()))
u = data[0]
k = data[1]
if i == 0:
start = u
for v in data[2:2+k]:
M[u-1][v-1] = True
def search(u,t):
t += 1
color[u-1] = "gray"
d[u-1].append(t)
for v in range(n):
if M[u-1][v-1] and color[v-1] == "white":
t = search(v,t)
color[u-1] = "black"
t += 1
d[u-1].append(t)
return t
search(start, t)
for i in range(n):
print(i+1, d[i][0], d[i][1])
| Traceback (most recent call last):
File "/tmp/tmp57hy820b/tmp9vsfjyj5.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s432471218 | p02238 | u882992966 | 1442792110 | Python | Python3 | py | Runtime Error | 0 | 0 | 3249 | import sys
WHITE = 0
GRAY = 1
BLACK = 2
def dbg_record(records):
for index, record in enumerate(records):
print("???????????????: %d" % index)
if isinstance(record, dict):
print("??\??????: %d" % record.get("visit", -1))
print("?????????: %d" % record.get("leave", -1))
else:
print("?????????")
print("")
def dfs(matrix):
def internal_dfs(node_id, current_time):
if state[node_id] == WHITE:
# ?¨??????????
state[node_id] = GRAY
stack.append(node_id)
records[node_id] = {"visit": current_time} # ?¨??????????????¨????
# ?¬?????¨????????????¨?????§????????????????????¢???
next_id = None
for index in range(len(matrix)):
if matrix[node_id][index] == 1 and state[index] == WHITE:
next_id = index
break
if next_id is not None:
internal_dfs(next_id, current_time + 1)
elif 0 < len(stack):
# ?¬?????¨????????????¨?????§?????????????????????????????????????????°?????????
internal_dfs(stack.pop(), current_time + 1)
elif state[node_id] == GRAY:
# ????????????
# ?¬?????¨????????????¨?????§????????????????????¢???
next_id = None
for index in range(len(matrix)):
if matrix[node_id][index] == 1 and state[index] == WHITE:
next_id = index
break
if next_id is not None:
stack.append(node_id)
# internal_dfs(next_id, current_time + 1)
internal_dfs(next_id, current_time)
elif 0 < len(stack):
# ?¬?????¨????????????¨?????§?????????????????????????????????????????°?????????
state[node_id] = BLACK
records[node_id]["leave"] = current_time # ????????????????¨????
internal_dfs(stack.pop(), current_time + 1)
else: # ??????????§????????????£???????????¨??? (node_id should be 0)
state[node_id] = BLACK
records[node_id]["leave"] = current_time
elif state[node_id] == BLACK:
print("Black!!")
state = [WHITE] * len(matrix) # White, Gray, Black
records = [None] * len(matrix) # Save time when the node is processed
stack = []
internal_dfs(0, 1)
# dbg_record(records)
return records
if __name__ == "__main__":
# ??????????????????
# lines = [
# "6",
# "1 2 2 3",
# "2 2 3 4",
# "3 1 5",
# "4 1 6",
# "5 1 6",
# "6 0",
# ]
lines = sys.stdin.readlines()
# Create n * n matrix
dimension = int(lines[0])
matrix = []
for x in range(dimension):
matrix.append([0] * dimension)
# Set edge info
for index, line in enumerate(lines[1:]):
for edge in [int(x) for x in line.strip().split(" ")[2:]]:
matrix[index][edge - 1] = 1
result = dfs(matrix)
for index, line in enumerate(result):
print("%d %d %d" % (index + 1, line.get("visit", -1), line.get("leave", -1))) | Traceback (most recent call last):
File "/tmp/tmpkhes__2b/tmpqsid85a5.py", line 87, in <module>
dimension = int(lines[0])
~~~~~^^^
IndexError: list index out of range
| |
s090808897 | p02238 | u563876281 | 1453863704 | Python | Python | py | Runtime Error | 0 | 0 | 192 | def depth(num)
for x[num]
n = raw_input
for i in range(n):
all = map(int,raw_input().split())
num = all[0]
x[i] = all[1]
if all[1] != 0:
ne[i] = all[2:]
for i in range(n)
depth(i)
| File "/tmp/tmpu27j07ka/tmp4uwsudsd.py", line 1
def depth(num)
^
SyntaxError: expected ':'
| |
s179080069 | p02238 | u253463900 | 1453873649 | Python | Python3 | py | Runtime Error | 0 | 0 | 1226 | class Node(object):
def __init__(self, V):
self.V = V
self.find_time = 0
self.finish_time = 0
self.is_finded = False
n = int(input())
nodes = [0] * 101
for i in range(n):
data = input().split()
V = list(map(int, data[2:]))
V.sort(reverse = True)
nodes[int(data[0])] = Node(V)
find_q = []
find_q.append(1)
cnt = 1
q_size = len(find_q)
while q_size != 0:
#print(find_q)
node = nodes[find_q[q_size -1]]
if node.is_finded == False:
node.find_time = cnt
cnt += 1
node.is_finded = True
if len(node.V) == 0:
node.finish_time = cnt
cnt += 1
del find_q[q_size -1]
q_size = len(find_q)
else:
for x in node.V:
if x in find_q:
find_q.remove(x)
if nodes[x].finish_time == 0:
find_q.append(x)
q_size = len(find_q)
else: #node is finded
node.finish_time = cnt
cnt += 1
del find_q[q_size -1]
q_size = len(find_q)
continue
for i in range(1, n+1):
if not isinstance(nodes[i], int)
print(i, nodes[i].find_time, nodes[i].finish_time) | File "/tmp/tmptkac344l/tmp563a6ejo.py", line 50
if not isinstance(nodes[i], int)
^
SyntaxError: expected ':'
| |
s837160204 | p02238 | u069446126 | 1453891550 | Python | Python | py | Runtime Error | 0 | 0 | 576 |
def DFS(i):
for j in range(n):
if A[i][j] == 1 and d[j] == 0:
time = time + 1
d[j] = time
DFS(j)
time = time + 1
f[i] = time
n = int(raw_input())
A = [0] * n
for i in range(n):
A[i] = [0] * n
for i in range(n):
value = map(int, raw_input().split())
u = value[0] - 1
k = value[1]
nodes = value[2:]
for i in range(k):
v = nodes[i] - 1
A[u][v] = 1
d = [0] * n
f = [0] * n
time = 1
d[0] = time
DFS(0)
for i in range(n):
print(str(i + 1) + " " + str(d[0]) + " " + str(f[0]))
| Traceback (most recent call last):
File "/tmp/tmppo6xpqe9/tmpses3zlfn.py", line 11, in <module>
n = int(raw_input())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s287560081 | p02238 | u069446126 | 1453891602 | Python | Python | py | Runtime Error | 0 | 0 | 628 |
# ??±???????????¢?´¢(Depth First Search)
def DFS(i, n):
for j in range(n):
if A[i][j] == 1 and d[j] == 0:
time = time + 1
d[j] = time
DFS(j)
time = time + 1
f[i] = time
n = int(raw_input())
A = [0] * n
for i in range(n):
A[i] = [0] * n
for i in range(n):
value = map(int, raw_input().split())
u = value[0] - 1
k = value[1]
nodes = value[2:]
for i in range(k):
v = nodes[i] - 1
A[u][v] = 1
d = [0] * n
f = [0] * n
time = 1
d[0] = time
DFS(0, n)
for i in range(n):
print(str(i + 1) + " " + str(d[0]) + " " + str(f[0]))
| Traceback (most recent call last):
File "/tmp/tmp7klqi7v7/tmpw_65hu9b.py", line 13, in <module>
n = int(raw_input())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s878128875 | p02238 | u069446126 | 1453891702 | Python | Python | py | Runtime Error | 0 | 0 | 747 | # ???±????????????¢??´?¢(Depth First Search)
??
def DFS(i = 0, n = 1):
????????for j in range(n):
????????????????if A[i][j] == 1 and d[j] == 0:
????????????????????????time = time + 1
????????????????????????d[j] = time
????????????????????????DFS(j)
????????time = time + 1
????????f[i] = time
??
n = int(raw_input())
A = [0] * n
for i in range(n):
????????A[i] = [0] * n
??
for i in range(n):
????????value = map(int, raw_input().split())
????????u = value[0] - 1
????????k = value[1]
????????nodes = value[2:]
????????for i in range(k):
????????????????v = nodes[i] - 1
????????????????A[u][v] = 1
??
d = [0] * n
f = [0] * n
time = 1
d[0] = time
DFS(0, n)
??
for i in range(n):
????????print(str(i + 1) + " " + str(d[0]) + " " + str(f[0])) | File "/tmp/tmpt_5geznj/tmpxm5ih8pr.py", line 2
??
^
SyntaxError: invalid syntax
| |
s572898005 | p02238 | u069446126 | 1453891854 | Python | Python | py | Runtime Error | 0 | 0 | 704 |
# ??±???????????¢?´¢(Depth First Search)
def DFS(n = 1, A = [0], i = 0, d = [0], f = [0], time = 1):
for j in range(n):
if A[i][j] == 1 and d[j] == 0:
time = time + 1
d[j] = time
DFS(n, A, j, d, f, time)
time = time + 1
f[i] = time
n = int(raw_input())
A = [0] * n
for i in range(n):
A[i] = [0] * n
for i in range(n):
value = map(int, raw_input().split())
u = value[0] - 1
k = value[1]
nodes = value[2:]
for i in range(k):
v = nodes[i] - 1
A[u][v] = 1
d = [0] * n
f = [0] * n
time = 1
d[0] = time
DFS(n, A, 0, d, f, time)
for i in range(n):
print(str(i + 1) + " " + str(d[0]) + " " + str(f[0])) | Traceback (most recent call last):
File "/tmp/tmpvtpbxh7n/tmpfwpwn_n9.py", line 13, in <module>
n = int(raw_input())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s276613399 | p02238 | u069446126 | 1453895960 | Python | Python | py | Runtime Error | 0 | 0 | 812 |
# ??±???????????¢?´¢(Depth First Search)
def DFS(n = 1, A = [0], i = 0, d = [0], f = [0], time = 1):
for j in range(n):
if A[i][j] == 1 and d[j] == 0:
time = time + 1
d[j] = time
time = DFS(n, A, j, d, f, time)
time = time + 1
f[i] = time
return time
n = int(raw_input())
A = [0] * n
for i in range(n):
A[i] = [0] * n
for i in range(n):
value = map(int, raw_input().split())
u = value[0] - 1
k = value[1]
nodes = value[2:]
for i in range(k):
v = nodes[i] - 1
A[u][v] = 1
d = [0] * n
f = [0] * n
time = 0
for i in range(n):
if d[i] == 0:
time = time + 1
d[i] = time
time = DFS(n, A, i, d, f, time)
for i in range(n):
print(str(i + 1) + " " + str(d[i]) + " " + str(f[i])) | Traceback (most recent call last):
File "/tmp/tmpp8syu9zc/tmpu33ci1bl.py", line 14, in <module>
n = int(raw_input())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s331996002 | p02238 | u069446126 | 1453896512 | Python | Python | py | Runtime Error | 0 | 0 | 767 |
# ??±???????????¢?´¢(Depth First Search)
def DFS(n = 1, i = 0, time = 1):
for j in range(n):
if A[i][j] == 1 and d[j] == 0:
time = time + 1
d[j] = time
time = DFS(n, j, time)
time = time + 1
f[i] = time
return time
n = int(raw_input())
A = [0] * n
for i in range(n):
A[i] = [0] * n
for i in range(n):
value = map(int, raw_input().split())
u = value[0] - 1
k = value[1]
nodes = value[2:]
for j in range(k):
v = nodes[j] - 1
A[u][v] = 1
d = [0] * n
f = [0] * n
time = 0
for i in range(n):
if d[i] == 0:
time = time + 1
d[i] = time
time = DFS(n, i, time)
for i in range(n):
print(str(i + 1) + " " + str(d[i]) + " " + str(f[i])) | Traceback (most recent call last):
File "/tmp/tmpyf9e5mkq/tmpl1b66lvt.py", line 14, in <module>
n = int(raw_input())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s498697145 | p02238 | u970436839 | 1454335727 | Python | Python | py | Runtime Error | 0 | 0 | 471 | def dfs_v(u):
color[u] = 1
d[u] = ++t
for v in range(n):
if M[u][v] == 0 and color[v] == 0:
dfs_v(v)
color[u] = 2
f[u] = ++t
def dfs():
color[0 for i in range(n)]
t = 0
for u in range(n):
dfs_v(u)
for u in range(n):
print "%d %d %d" %(u+1, d[u], f[u])
n = input()
M[0 for i in range(n)]0 for j in range(n)]
for i in range(n):
u, k = map(int, raw_input().split())
for j in range(n):
v = input()
M[u-1][v-1] = 1
dfs()
| File "/tmp/tmp9hbrkbix/tmp4waa5bqj.py", line 20
M[0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s592785614 | p02238 | u970436839 | 1454335755 | Python | Python | py | Runtime Error | 0 | 0 | 467 | def dfs_v(u):
color[u] = 1
d[u] = ++t
for v in range(n):
if M[u][v] == 0 and color[v] == 0:
dfs_v(v)
color[u] = 2
f[u] = ++t
def dfs():
color[0 for i in range(n)]
t = 0
for u in range(n):
dfs_v(u)
for u in range(n):
print "%d %d %d" %(u+1, d[u], f[u])
n = input()
M[0 for i in range(n)]0 for j in range(n)]
for i in range(n):
u, k = map(int, raw_input().split())
for j in range(n):
v = input()
M[u][v] = 1
dfs()
| File "/tmp/tmp71753l1d/tmp9h_o9c3p.py", line 20
M[0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s862165395 | p02238 | u970436839 | 1454335774 | Python | Python | py | Runtime Error | 0 | 0 | 471 | def dfs_v(u):
color[u] = 1
d[u] = ++t
for v in range(n):
if M[u][v] == 0 and color[v] == 0:
dfs_v(v)
color[u] = 2
f[u] = ++t
def dfs():
color[0 for i in range(n)]
t = 0
for u in range(n):
dfs_v(u)
for u in range(n):
print "%d %d %d" %(u+1, d[u], f[u])
n = input()
M[0 for i in range(n)]0 for j in range(n)]
for i in range(n):
u, k = map(int, raw_input().split())
for j in range(k):
v = input()
M[u-1][v-1] = 1
dfs()
| File "/tmp/tmp0ktayjnx/tmp7vh86z4i.py", line 20
M[0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s189065166 | p02238 | u970436839 | 1454335890 | Python | Python | py | Runtime Error | 0 | 0 | 529 | def dfs_v(u):
color[u] = 1
d[u] = ++t
for v in range(n):
if M[u][v] == 0 and color[v] == 0:
dfs_v(v)
color[u] = 2
f[u] = ++t
def dfs():
color = [0 for i in range(n)]
t = 0
for u in range(n):
dfs_v(u)
for u in range(n):
print "%d %d %d" %(u+1, d[u], f[u])
n = input()
d = [0 for i in range(n)]
f = [0 for i in range(n)]
M = [0 for i in range(n)]0 for j in range(n)]
for i in range(n):
u, k = map(int, raw_input().split())
for j in range(k):
v = input()
M[u-1][v-1] = 1
dfs()
| File "/tmp/tmp6sbn8nod/tmpzpbje8b4.py", line 22
M = [0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s535010956 | p02238 | u970436839 | 1454335931 | Python | Python | py | Runtime Error | 0 | 0 | 539 | def dfs_v(u):
color[u] = 1
t++
d[u] += t
for v in range(n):
if M[u][v] == 0 and color[v] == 0:
dfs_v(v)
color[u] = 2
t++
f[u] += t
def dfs():
color = [0 for i in range(n)]
t = 0
for u in range(n):
dfs_v(u)
for u in range(n):
print "%d %d %d" %(u+1, d[u], f[u])
n = input()
d = [0 for i in range(n)]
f = [0 for i in range(n)]
M = [0 for i in range(n)]0 for j in range(n)]
for i in range(n):
u, k = map(int, raw_input().split())
for j in range(k):
v = input()
M[u-1][v-1] = 1
dfs()
| File "/tmp/tmpaadoo2rg/tmp9mdr2w3p.py", line 24
M = [0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s366336258 | p02238 | u970436839 | 1454335962 | Python | Python | py | Runtime Error | 0 | 0 | 545 | def dfs_v(u):
color[u] = 1
t += 1
d[u] += t
for v in range(n):
if M[u][v] == 0 and color[v] == 0:
dfs_v(v)
color[u] = 2
t += 1
f[u] += t
def dfs():
color = [0 for i in range(n)]
t = 0
for u in range(n):
dfs_v(u)
for u in range(n):
print "%d %d %d" %(u+1, d[u], f[u])
n = input()
d = [0 for i in range(n)]
f = [0 for i in range(n)]
M = [0 for i in range(n)]0 for j in range(n)]
for i in range(n):
u, k = map(int, raw_input().split())
for j in range(k):
v = input()
M[u-1][v-1] = 1
dfs()
| File "/tmp/tmpz2gvop85/tmpoa7c4ag9.py", line 24
M = [0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s006785209 | p02238 | u970436839 | 1454336110 | Python | Python | py | Runtime Error | 0 | 0 | 543 | def dfs_v(u):
color[u] = 1
t += 1
d[u] = t
for v in range(n):
if M[u][v] == 0 and color[v] == 0:
dfs_v(v)
color[u] = 2
t += 1
f[u] = t
def dfs():
color = [0 for i in range(n)]
t = 0
for u in range(n):
dfs_v(u)
for u in range(n):
print "%d %d %d" %(u+1, d[u], f[u])
n = input()
d = [0 for i in range(n)]
f = [0 for i in range(n)]
M = [0 for i in range(n)]0 for j in range(n)]
for i in range(n):
u, k = map(int, raw_input().split())
for j in range(k):
v = input()
M[u-1][v-1] = 1
dfs()
| File "/tmp/tmptt51_wex/tmpr3q0n0ge.py", line 24
M = [0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s378224369 | p02238 | u970436839 | 1454336186 | Python | Python | py | Runtime Error | 0 | 0 | 529 | def dfs_v(u):
color[u] = 1
t += 1
d[u] = t
for v in range(n):
if M[u][v] == 0 and color[v] == 0:
dfs_v(v)
color[u] = 2
t += 1
f[u] = t
def dfs():
color = [0 for i in range(n)]
t = 0
for u in range(n):
dfs_v(u)
for u in range(n):
print u+1, d[u], f[u]
n = input()
d = [0 for i in range(n)]
f = [0 for i in range(n)]
M = [0 for i in range(n)]0 for j in range(n)]
for i in range(n):
u, k = map(int, raw_input().split())
for j in range(k):
v = input()
M[u-1][v-1] = 1
dfs()
| File "/tmp/tmpcu_xpgfn/tmpuc8n9qmm.py", line 24
M = [0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s333083236 | p02238 | u970436839 | 1454336296 | Python | Python | py | Runtime Error | 0 | 0 | 565 | def dfs_v(u):
color[u] = 1
t += 1
d[u] = t
for v in range(n):
if M[u][v] == 0 and color[v] == 0:
dfs_v(v)
color[u] = 2
t += 1
f[u] = t
def dfs():
color = [0 for i in range(n)]
t = 0
for u in range(n):
dfs_v(u)
for u in range(n):
print u+1, d[u], f[u]
n = input()
color = [0 for i in range(100)]
d = [0 for i in range(100)]
f = [0 for i in range(100)]
M = [0 for i in range(n)]0 for j in range(n)]
for i in range(n):
u, k = map(int, raw_input().split())
for j in range(k):
v = input()
M[u-1][v-1] = 1
dfs()
| File "/tmp/tmp0b3388si/tmp8zycv9vy.py", line 25
M = [0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s686093371 | p02238 | u970436839 | 1454336401 | Python | Python | py | Runtime Error | 0 | 0 | 589 | def dfs_v(u):
color[u] = 1
t += 1
d[u] = t
for v in range(n):
if M[u][v] == 0 and color[v] == 0:
dfs_v(v)
color[u] = 2
t += 1
f[u] = t
def dfs():
color = [0 for i in range(n)]
t = 0
for u in range(n):
if color[u] == 0:
dfs_v(u)
for u in range(n):
print u+1, d[u], f[u]
n = input()
color = [0 for i in range(100)]
d = [0 for i in range(100)]
f = [0 for i in range(100)]
M = [0 for i in range(n)]0 for j in range(n)]
for i in range(n):
u, k = map(int, raw_input().split())
for j in range(k):
v = input()
M[u-1][v-1] = 1
dfs()
| File "/tmp/tmpd86z679_/tmptj8ap1io.py", line 26
M = [0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s798532328 | p02238 | u970436839 | 1454336556 | Python | Python | py | Runtime Error | 0 | 0 | 557 | def dfs_v(u):
color[u] = 1
t += 1
d[u] = t
for v in range(n):
if M[u][v] == 1 and color[v] == 0:
dfs_v(v)
color[u] = 2
t += 1
f[u] = t
def dfs():
t = 0
for u in range(n):
if color[u] == 0:
dfs_v(u)
for u in range(n):
print u+1, d[u], f[u]
n = input()
color = [0 for i in range(100)]
d = [0 for i in range(100)]
f = [0 for i in range(100)]
M = [0 for i in range(n)]0 for j in range(n)]
for i in range(n):
u, k = map(int, raw_input().split())
for j in range(k):
v = input()
M[u-1][v-1] = 1
dfs()
| File "/tmp/tmply9l_tf6/tmphrtsz3n_.py", line 25
M = [0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s204152945 | p02238 | u970436839 | 1454336921 | Python | Python | py | Runtime Error | 0 | 0 | 549 | def dfs_v(u):
color[u] = 1
t += 1
d[u] = t
for v in range(n):
if M[u][v] == 1 and color[v] == 0:
dfs_v(v)
color[u] = 2
t += 1
f[u] = t
def dfs():
t = 0
for u in range(n):
if color[u] == 0:
dfs_v(u)
for u in range(n):
print u+1, d[u], f[u]
n = input()
color = [0 for i in range(100)]
d = [0 for i in range(100)]
f = [0 for i in range(100)]
M = [0 for i in range(n)]0 for j in range(n)]
for i in range(n):
X = map(int, raw_input().split())
for j in range(X[1]):
M[X[0]] [X[2+j]-1] = 1
dfs()
| File "/tmp/tmp67tkiiqf/tmpku36g9tv.py", line 25
M = [0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s152657657 | p02238 | u970436839 | 1454336983 | Python | Python | py | Runtime Error | 0 | 0 | 549 | n = input()
color = [0 for i in range(100)]
d = [0 for i in range(100)]
f = [0 for i in range(100)]
M = [0 for i in range(n)]0 for j in range(n)]
def dfs_v(u):
color[u] = 1
t += 1
d[u] = t
for v in range(n):
if M[u][v] == 1 and color[v] == 0:
dfs_v(v)
color[u] = 2
t += 1
f[u] = t
def dfs():
t = 0
for u in range(n):
if color[u] == 0:
dfs_v(u)
for u in range(n):
print u+1, d[u], f[u]
for i in range(n):
X = map(int, raw_input().split())
for j in range(X[1]):
M[X[0]] [X[2+j]-1] = 1
dfs()
| File "/tmp/tmpmgq0qyx_/tmpk4suhs5u.py", line 6
M = [0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s391405642 | p02238 | u970436839 | 1454337310 | Python | Python | py | Runtime Error | 0 | 0 | 543 | n = input()
color = [0 for i in range(n)]
d = [0 for i in range(n)]
f = [0 for i in range(n)]
M = [0 for i in range(n)]0 for j in range(n)]
def dfs_v(u):
color[u] = 1
t += 1
d[u] = t
for v in range(n):
if M[u][v] == 1 and color[v] == 0:
dfs_v(v)
color[u] = 2
t += 1
f[u] = t
def dfs():
t = 0
for u in range(n):
if color[u] == 0:
dfs_v(u)
for u in range(n):
print u+1, d[u], f[u]
for i in range(n):
X = map(int, raw_input().split())
for j in range(X[1]):
M[X[0]] [X[2+j]-1] = 1
dfs()
| File "/tmp/tmpvqfi7g86/tmpipdqc2a0.py", line 6
M = [0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s829424732 | p02238 | u970436839 | 1454337387 | Python | Python | py | Runtime Error | 0 | 0 | 545 | n = input()
color = [0 for i in range(n)]
d = [0 for i in range(n)]
f = [0 for i in range(n)]
M = [0 for i in range(n)]0 for j in range(n)]
def dfs_v(u):
color[u] = 1
t += 1
d[u] = t
for v in range(n):
if M[u][v] == 1 and color[v] == 0:
dfs_v(v)
color[u] = 2
t += 1
f[u] = t
def dfs():
t = 0
for u in range(n):
if color[u] == 0:
dfs_v(u)
for u in range(n):
print u+1, d[u], f[u]
for i in range(n):
X = map(int, raw_input().split())
for j in range(X[1]):
M[X[0]-1] [X[2+j]-1] = 1
dfs()
| File "/tmp/tmpq7onzkvr/tmp40m3ct03.py", line 6
M = [0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s315585105 | p02238 | u970436839 | 1454337823 | Python | Python | py | Runtime Error | 0 | 0 | 543 | n = input()
color = [0 for i in range(n)]
d = [0 for i in range(n)]
f = [0 for i in range(n)]
M = [0 for i in range(n)]0 for j in range(n)]
t = 0
def dfs_v(u):
color[u] = 1
t += 1
d[u] = t
for v in range(n):
if M[u][v] == 1 and color[v] == 0:
dfs_v(v)
color[u] = 2
t += 1
f[u] = t
def dfs():
for u in range(n):
if color[u] == 0:
dfs_v(u)
for u in range(n):
print u+1, d[u], f[u]
for i in range(n):
X = map(int, raw_input().split())
for j in range(X[1]):
M[X[0]-1] [X[2+j]-1] = 1
dfs()
| File "/tmp/tmpi0t9rkae/tmpux8e3qoe.py", line 6
M = [0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s532429086 | p02238 | u970436839 | 1454337876 | Python | Python | py | Runtime Error | 0 | 0 | 544 | n = input()
color = [0 for i in range(n)]
d = [0 for i in range(n)]
f = [0 for i in range(n)]
M = [0 for i in range(n)]0 for j in range(n)]
t = 0
def dfs_v(u):
color[u] = 1
t += 1
d[u] = t
for v in range(n):
if M[u][v] == 1 and color[v] == 0:
dfs_v(v)
color[u] = 2
t += 1
f[u] = t
def dfs():
for u in range(n):
if color[u] == 0:
dfs_v(u)
for u in range(n):
print u+1, d[u], f[u]
for i in range(n):
X = map(int, raw_input().split())
for j in range(X[1]):
M[X[0]-1] [X[2+j]-1] = 1
dfs()
| File "/tmp/tmpgi6q4l4x/tmpjxd9z49h.py", line 6
M = [0 for i in range(n)]0 for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s120244661 | p02238 | u970436839 | 1454337918 | Python | Python | py | Runtime Error | 0 | 0 | 543 | n = input()
color = [0 for i in range(n)]
d = [0 for i in range(n)]
f = [0 for i in range(n)]
M = [0 for i in range(n)] for j in range(n)]
t = 0
def dfs_v(u):
color[u] = 1
t += 1
d[u] = t
for v in range(n):
if M[u][v] == 1 and color[v] == 0:
dfs_v(v)
color[u] = 2
t += 1
f[u] = t
def dfs():
for u in range(n):
if color[u] == 0:
dfs_v(u)
for u in range(n):
print u+1, d[u], f[u]
for i in range(n):
X = map(int, raw_input().split())
for j in range(X[1]):
M[X[0]-1] [X[2+j]-1] = 1
dfs()
| File "/tmp/tmpdk2hhmsx/tmplb1f9icu.py", line 6
M = [0 for i in range(n)] for j in range(n)]
^
SyntaxError: unmatched ']'
| |
s745903078 | p02238 | u970436839 | 1454337930 | Python | Python | py | Runtime Error | 0 | 0 | 543 | n = input()
color = [0 for i in range(n)]
d = [0 for i in range(n)]
f = [0 for i in range(n)]
M = [[0 for i in range(n)] for j in range(n)]
t = 0
def dfs_v(u):
color[u] = 1
t += 1
d[u] = t
for v in range(n):
if M[u][v] == 1 and color[v] == 0:
dfs_v(v)
color[u] = 2
t += 1
f[u] = t
def dfs():
for u in range(n):
if color[u] == 0:
dfs_v(u)
for u in range(n):
print u+1, d[u], f[u]
for i in range(n):
X = map(int, raw_input().split())
for j in range(X[1]):
M[X[0]-1][X[2+j]-1] = 1
dfs()
| File "/tmp/tmp_qxdga12/tmpr1dkitmo.py", line 25
print u+1, d[u], f[u]
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.