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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s233520410 | p02573 | u314188085 | 1598816178 | Python | Python (3.8.2) | py | Runtime Error | 2345 | 149196 | 479 | from sys import setrecursionlimit
def find(par,i):
if par[i]<0:
return i
par[i] = find(par,par[i])
return par[i]
def unite(par,i,j):
ri = find(par,i)
rj = find(par, j)
if ri==rj:
return
par[rj] += par[ri]
par[ri] = rj
setrecursionlimit(10**6)
n,m = map(int,input().... | Traceback (most recent call last):
File "/tmp/tmp14pp6jrc/tmpk6rz6241.py", line 18, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s698232704 | p02573 | u970937288 | 1598815191 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 89480 | 518 | n,m=map(int,input().split())
k=[]
l=[-1 for i in range(n)]
for i in range(m):
a,b=map(int,input().split())
if a>b:
a,b=b,a
a,b=a-1,b-1
if l[a]<0 and l[b]<0:
k+=[[a,b]]
l[a],l[b]=len(k)-1,len(k)-1
elif l[a]<0:
k[l[b]]+=[a]
l[a]=l[b]
elif l[b]<0:
k[l... | Traceback (most recent call last):
File "/tmp/tmppyp9n66h/tmpn34hu8c3.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s792954948 | p02573 | u821322673 | 1598814867 | Python | PyPy3 (7.3.0) | py | Runtime Error | 712 | 86160 | 719 | #unionfind木_
def find(k):#要素k
if par[k] == k:
return par[k]
else:
par[k] = find(par[k])
return par[k]
def union(i, j):
i = find(i)
j = find(j)
if i==j: return False
else:
if rank[i] == rank[j]:#ランクが同じ場合
par[j] = par[i]
rank[i] += 1
... | Traceback (most recent call last):
File "/tmp/tmpxzl_3__4/tmp8pqry7fl.py", line 24, in <module>
n, m= map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s970033248 | p02573 | u821322673 | 1598814076 | Python | PyPy3 (7.3.0) | py | Runtime Error | 673 | 169896 | 1082 | #unionfind木_
class unionfind():
def __init__(self, init_list, ide_ele=1):
self.par = init_list #初めは自分自身が親
self.rank = [ide_ele]*len(init_list)
def find(self, k):#要素k
if self.par[k] == k:
return self.par[k]
else:
self.par[k] = self.find(self.par[k])
... | Traceback (most recent call last):
File "/tmp/tmpxz8x_tl9/tmpjgslhn9u.py", line 28, in <module>
n, m= map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s109700273 | p02573 | u335599768 | 1598811355 | Python | Python (3.8.2) | py | Runtime Error | 715 | 14028 | 512 | n, m = map(int, input().split())
root = [-1] * n
def r(x):
if root[x] < 0:
return x
else:
root[x] = r(root[x])
return root[x]
def unite(x, y):
x = r(x)
y = r(y)
if x == y:
return
root[x] += root[y]
root[y] = x
def size(x):
x = r(x)
return ... | Traceback (most recent call last):
File "/tmp/tmp_9d0uwx_/tmplxgs90si.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s366252366 | p02573 | u530383736 | 1598810915 | Python | Python (3.8.2) | py | Runtime Error | 714 | 106248 | 1089 | # -*- coding: utf-8 -*-
import sys
def main():
N,M = list(map(int, sys.stdin.readline().split()))
AB_list = [ list(map(int, sys.stdin.readline().split())) for _ in range(M) ]
edge = {}
# { int : set }
# { the number of human : {friends} }
for a,b in AB_list:
edge.setdefault(a, set()... | Traceback (most recent call last):
File "/tmp/tmpbv8620_f/tmpzf2u11i5.py", line 56, in <module>
main()
File "/tmp/tmpbv8620_f/tmpzf2u11i5.py", line 6, in main
N,M = list(map(int, sys.stdin.readline().split()))
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s732692534 | p02573 | u496009935 | 1598810038 | Python | Python (3.8.2) | py | Runtime Error | 2209 | 91608 | 497 | def get_unique_list(seq):
seen = []
return [x for x in seq if x not in seen and not seen.append(x)]
n,m=map(int,input().split())
L=[list(map(int,input().split())) for _ in range(m)]
M=[]
for i in range(m):
if M==[]:
M.append(L[i])
else:
for j in range(len(L)):
if L[i][0] i... | Traceback (most recent call last):
File "/tmp/tmpzgbtsejk/tmp51j3wqbn.py", line 5, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s474276555 | p02573 | u198336369 | 1598809907 | Python | Python (3.8.2) | py | Runtime Error | 744 | 40244 | 686 | import collections
n, m = map(int, input().split())
par = [i for i in range(0,n+1)]
# print(par)
s = list()
# union find(parには0も入れているので、par[1]=1になる)
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
return par[x]
def union(x,y):
x = find(x)
y = find(y)
if x =... | Traceback (most recent call last):
File "/tmp/tmpjzm8bp79/tmpot5kerih.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s652202004 | p02573 | u594803920 | 1598809838 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2430 | 3500360 | 1446 | import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bise... | Traceback (most recent call last):
File "/tmp/tmp8tegvdyt/tmpvzmg_qcc.py", line 28, in <module>
N,M = map(int,input().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s668468238 | p02573 | u198336369 | 1598809732 | Python | Python (3.8.2) | py | Runtime Error | 2350 | 148856 | 714 | import collections
n, m = map(int, input().split())
par = [i for i in range(0,n+1)]
# print(par)
s = list()
# union find(parには0も入れているので、par[1]=1になる)
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
return par[x]
def union(x,y):
x = find(x)
y = find(y)
if x =... | Traceback (most recent call last):
File "/tmp/tmpb9ivovz1/tmp1u1khzuh.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s412063404 | p02573 | u198336369 | 1598809354 | Python | Python (3.8.2) | py | Runtime Error | 676 | 40264 | 709 | import collections
n, m = map(int, input().split())
par = [i for i in range(0,n+1)]
# print(par)
s = list()
# union find(parには0も入れているためインデックスを変える必要はない)
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
return par[x]
def union(x,y):
x = find(x)
y = find(y)
if ... | Traceback (most recent call last):
File "/tmp/tmpcol3n7mw/tmpr94g5rjm.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s752848958 | p02573 | u924691798 | 1598808185 | Python | Python (3.8.2) | py | Runtime Error | 936 | 25396 | 827 | class UnionFind:
def __init__(self, n):
self.parent = [i for i in range(n)]
self.num = [1 for i in range(n)]
def root(self, x):
if self.parent[x] == x:
return x
else:
self.parent[x] = self.root(self.parent[x])
return self.parent[x]
def un... | Traceback (most recent call last):
File "/tmp/tmprcpglbic/tmps21rpyv6.py", line 26, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s309437531 | p02573 | u198336369 | 1598807413 | Python | Python (3.8.2) | py | Runtime Error | 730 | 40388 | 504 | import collections
n, m = map(int, input().split())
par = [i for i in range(0,n+1)]
# print(par)
s =list()
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
return par[x]
def union(x,y):
x = find(x)
y = find(y)
if x == y:
return 0
else:
par... | Traceback (most recent call last):
File "/tmp/tmp07nl9292/tmpsv1zkqzu.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s057711800 | p02573 | u594803920 | 1598807219 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2346 | 3520108 | 1427 | import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bise... | Traceback (most recent call last):
File "/tmp/tmp5aa5yu9z/tmpfee3pgwd.py", line 28, in <module>
N,M = map(int,input().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s764646420 | p02573 | u198336369 | 1598806790 | Python | Python (3.8.2) | py | Runtime Error | 713 | 40156 | 514 | import collections
n, m = map(int, input().split())
par = [i for i in range(0,n+1)]
# print(par)
s =list()
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
return par[x]
def union(x,y):
x = find(x)
y = find(y)
if x == y:
return 0
else:
par... | Traceback (most recent call last):
File "/tmp/tmpzn0t37wq/tmprbg1meyn.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s845336454 | p02573 | u198336369 | 1598806000 | Python | Python (3.8.2) | py | Runtime Error | 729 | 40132 | 487 | import collections
n, m = map(int, input().split())
par = [i for i in range(n+1)]
s =list()
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
return par[x]
def union(x,y):
x = find(x)
y = find(y)
if x == y:
return 0
else:
par[x] = y
for j i... | Traceback (most recent call last):
File "/tmp/tmpfjqhazdq/tmppke86qbc.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s021371919 | p02573 | u250734103 | 1598805917 | Python | Python (3.8.2) | py | Runtime Error | 906 | 27052 | 1261 | N, M = map(int, input().split())
A = [0] * M
B = [0] * M
for i in range(M):
A[i], B[i] = map(int, input().split())
class UnionFind:
def __init__(self, n):
# 親要素のノード番号を格納。par[x] == xの時そのノードは根
self.par = [-1 for i in range(n + 1)]
# 検索
# 根ならその番号を返す
def find(self, x):
... | Traceback (most recent call last):
File "/tmp/tmp6m4gzxsv/tmpmugyy5lp.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s328472282 | p02573 | u250734103 | 1598805092 | Python | Python (3.8.2) | py | Runtime Error | 352 | 24496 | 1639 | N, M = map(int, input().split())
A = [0] * (M-1)
B = [0] * (M-1)
for i in range(M):
A[i], B[i] = map(int, input().split())
class UnionFind:
def __init__(self, n):
# 親要素のノード番号を格納。par[x] == xの時そのノードは根
self.par = [-1 for i in range(n + 1)]
# 木の高さを格納する(初期状態では0)
"""self.rank = [0] * ... | Traceback (most recent call last):
File "/tmp/tmp5s553gxp/tmpo_0czuv3.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s193434732 | p02573 | u250734103 | 1598804739 | Python | Python (3.8.2) | py | Runtime Error | 896 | 27040 | 1631 | N, M = map(int, input().split())
A = [0] * M
B = [0] * M
for i in range(M):
A[i], B[i] = map(int, input().split())
class UnionFind:
def __init__(self, n):
# 親要素のノード番号を格納。par[x] == xの時そのノードは根
self.par = [-1 for i in range(n + 1)]
# 木の高さを格納する(初期状態では0)
"""self.rank = [0] * (n + 1)"... | Traceback (most recent call last):
File "/tmp/tmpca1fywt_/tmpt5o8wh0t.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s658125962 | p02573 | u250734103 | 1598804704 | Python | Python (3.8.2) | py | Runtime Error | 1099 | 31016 | 1592 | N, M = map(int, input().split())
A = [0] * M
B = [0] * M
for i in range(M):
A[i], B[i] = map(int, input().split())
class UnionFind:
def __init__(self, n):
# 親要素のノード番号を格納。par[x] == xの時そのノードは根
self.par = [-1 for i in range(n + 1)]
# 木の高さを格納する(初期状態では0)
"""self.rank = [0] * (n + 1)"... | Traceback (most recent call last):
File "/tmp/tmpbqw79e59/tmp2b662qcg.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s813687048 | p02573 | u414050834 | 1598804037 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9020 | 809 | n,m=map(int,input().split())
root=[-1]*n
def r(x): #-1の項が何番目かを特定
if root[x]<0: #x番目が-1ならx(>=0)を返す
return x
else: #x番目が0以上なら-1の項に到達するまで回す
root[x]=r(root[x])
return root[x] #-1の項に到達したらその項が何番目かを返す
def unite(x,y):
x=r(x)
y=r(y)
if x==y: #同じ項に到達した場合は処理の必要なし
return
root[x]+=root[y] #-1ずつ加算していく
... | File "/tmp/tmpc_e4_6ef/tmp0xg8l_3t.py", line 3
def r(x): #-1の項が何番目かを特定
^
SyntaxError: invalid non-printable character U+3000
| |
s545003524 | p02573 | u250734103 | 1598803944 | Python | Python (3.8.2) | py | Runtime Error | 895 | 27068 | 1631 | N, M = map(int, input().split())
A = [0] * M
B = [0] * M
for i in range(M):
A[i], B[i] = map(int, input().split())
class UnionFind:
def __init__(self, n):
# 親要素のノード番号を格納。par[x] == xの時そのノードは根
self.par = [-1 for i in range(n + 1)]
# 木の高さを格納する(初期状態では0)
"""self.rank = [0] * (n + 1)"... | Traceback (most recent call last):
File "/tmp/tmp1k2g7j7r/tmpzjm8g3u_.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s312480781 | p02573 | u259543319 | 1598803531 | Python | Python (3.8.2) | py | Runtime Error | 889 | 88004 | 712 | # Python template
from collections import defaultdict
import sys
import math
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
g = defaultdict(set)
(n,m) = get_ints()
... | Traceback (most recent call last):
File "/tmp/tmpbdu7o3m1/tmpdwyquixe.py", line 12, in <module>
(n,m) = get_ints()
^^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s570364364 | p02573 | u236885379 | 1598802531 | Python | Python (3.8.2) | py | Runtime Error | 1059 | 83392 | 433 | n, m = map(int, input().split())
grid = [set() for i in range(n)]
for i in range(m):
u, v = map(int, input().split())
u -= 1
v -= 1
grid[u].add(v)
grid[v].add(u)
cnt = 0
best = 0
visited = set()
def dfs(x):
global cnt
if x in visited:
return
cnt += 1
visited.add(x)
for... | Traceback (most recent call last):
File "/tmp/tmp4zphtk5x/tmpn7pt9l6u.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s070394795 | p02573 | u356983865 | 1598802020 | Python | Python (3.8.2) | py | Runtime Error | 572 | 50372 | 641 | from collections import deque
N,M = map(int,input().split())
hint_list = [list(map(int,input().split())) for i in range(M)]
r = [-1] * N
def find(a):
if r[a] < 0:
return a
else:
if r[r[a]] < 0:
return r[a]
else:
r[a] =r[r[a]]
return r[a]
def u... | Traceback (most recent call last):
File "/tmp/tmpng6fo6uq/tmpwi0n94bn.py", line 3, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s999449321 | p02573 | u356983865 | 1598801895 | Python | Python (3.8.2) | py | Runtime Error | 2358 | 172944 | 654 | from collections import deque
N,M = map(int,input().split())
hint_list = [list(map(int,input().split())) for i in range(M)]
r = [-1] * N
def find(a):
if r[a] < 0:
return a
else:
if r[r[a]] < 0:
return r[a]
else:
r[a] =r[r[a]]
return r[a]
def u... | Traceback (most recent call last):
File "/tmp/tmpyzsoc59k/tmpnhtyov14.py", line 3, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s708619191 | p02573 | u452512115 | 1598801215 | Python | Python (3.8.2) | py | Runtime Error | 773 | 52564 | 336 | N, M = map(int, input().split())
#AB = [tuple(map(int, input().split())) for i in range(M)]
#丸暗記。隣接リストの初期化
graph = [[i+1] for i in range(M)]
for _ in range(M):
a, b = map(int, input().split())
graph[a-1].append(b)
graph[b-1].append(a)
ans = -1
for g in graph:
ans = max(ans, len(set(g)))
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpb9eq5id5/tmpwsd9e4lh.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s424489751 | p02573 | u506689504 | 1598801033 | Python | Python (3.8.2) | py | Runtime Error | 843 | 49964 | 557 | N, M = map(int, input().split())
friends = [[] for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
a = a-1
b = b-1
friends[a].append(b)
friends[b].append(a)
counted = [False]*N
def grouping(i): # return list of friends of i
i_friends = friends[i]
ret = [i]
for f in i_friends:
if counted[f... | Traceback (most recent call last):
File "/tmp/tmpavh0lole/tmp05q4dxpf.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s138033276 | p02573 | u699522269 | 1598800891 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2207 | 111372 | 824 | import sys
input = sys.stdin.readline
N,M = map(int,input().split())
dic = {}
sets = {0}
for _ in range(M):
a,b = map(int,input().split())
if a in sets or b in sets:
if a in sets and b in sets:
tmp_a = 0
tmp_b = 1
# つなげる処理
for key in dic.keys():
if a in dic[key]:
tmp_a... | Traceback (most recent call last):
File "/tmp/tmpi6wvyaz5/tmpsejgz6qq.py", line 4, in <module>
N,M = map(int,input().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s361857212 | p02573 | u699522269 | 1598800759 | Python | PyPy3 (7.3.0) | py | Runtime Error | 528 | 111292 | 818 | import sys
input = sys.stdin.readline
N,M = map(int,input().split())
dic = {}
sets = {0}
for _ in range(M):
a,b = map(int,input().split())
if a in sets or b in sets:
if a and b in sets:
tmp_a = 0
tmp_b = 1
# つなげる処理
for key in dic.keys():
if a in dic[key]:
tmp_a = key
... | Traceback (most recent call last):
File "/tmp/tmpg7uu6mkx/tmp_7avrjqq.py", line 4, in <module>
N,M = map(int,input().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s846254128 | p02573 | u094213642 | 1598799459 | Python | Python (3.8.2) | py | Runtime Error | 645 | 64804 | 433 | # union-find
import collections
n, m = list(map(int, input().split()))
list = [list(map(int, input().split())) for x in range(m)]
par = [i for i in range(n+1)]
for i in list:
par[i[0]] = i[1]
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x]) #経路圧縮
return par[x]
... | Traceback (most recent call last):
File "/tmp/tmp6dv7fz5c/tmp8gvjk7nt.py", line 5, in <module>
n, m = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s411753161 | p02573 | u337626942 | 1598798976 | Python | PyPy3 (7.3.0) | py | Runtime Error | 480 | 167548 | 794 | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x =... | Traceback (most recent call last):
File "/tmp/tmpunbihozd/tmppaxk89yy.py", line 28, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s909528101 | p02573 | u337626942 | 1598797435 | Python | PyPy3 (7.3.0) | py | Runtime Error | 92 | 76392 | 799 | import sys
sys.setrecursionlimit(10 ** 9)
class Union_Find:
def __init__(self, n):
self.root = [-1]*n
def find(self, x):
if self.root[x] < 0:
return x
else:
self.root[x] = self.find(self.root[x])
return root[x]
def unite(self, x, y):
... | Traceback (most recent call last):
File "/tmp/tmpwbzq3rhc/tmp2t6eiqlk.py", line 28, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s198593637 | p02573 | u686230543 | 1598796370 | Python | Python (3.8.2) | py | Runtime Error | 1073 | 105000 | 1036 | def zero_origin(s: str):
return int(s) - 1
class UnionFindTree:
"""Union Find Tree for disjoint-set data structure.
Args:
n (int): number of the vertices.
"""
def __init__(self, n: int):
self.parent = list(range(n))
self.rank = [0] * n
self.size = [1] * n
def find(self, i: int) -> int:
... | Traceback (most recent call last):
File "/tmp/tmpx3mokom5/tmp9ypxy5bn.py", line 39, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s251128056 | p02573 | u686230543 | 1598796348 | Python | Python (3.8.2) | py | Runtime Error | 1069 | 104980 | 1036 | def zero_origin(s: str):
return int(s) - 1
class UnionFindTree:
"""Union Find Tree for disjoint-set data structure.
Args:
n (int): number of the vertices.
"""
def __init__(self, n: int):
self.parent = list(range(n))
self.rank = [0] * n
self.size = [1] * n
def find(self, i: int) -> int:
... | Traceback (most recent call last):
File "/tmp/tmpgcz12tf8/tmpky0fzvpb.py", line 39, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s226539943 | p02573 | u991542950 | 1598795574 | Python | PyPy3 (7.3.0) | py | Runtime Error | 85 | 74672 | 977 | lass UnionFind:
def __init__(self, n):
self.parent = [-1] * n
self.rank = [1] * n
self.count = [1] * n
def get_root(self, i):
if self.parent[i] == i:
return i
else:
self.parent[i] = self.get_root(self.parent[i])
return self.parent[i]
#while self.parent[i] != -1:
# i =... | File "/tmp/tmp4ayf9pkv/tmpa_q6xk1p.py", line 1
lass UnionFind:
^^^^^^^^^
SyntaxError: invalid syntax
| |
s417105055 | p02573 | u347064383 | 1598794548 | Python | Python (3.8.2) | py | Runtime Error | 524 | 12784 | 954 | # 接続最大クラスタのサイズが答え?
N, M = [int(x) for x in input().split(' ')]
# from collections import defaultdict
# d = defaultdict(set)
# for i in range(M):
# a, b = [int(x) for x in input().split(' ')]
# d[a].add(b)
# d[b].add(a)
class UF:
def __init__(self):
self.r = [-1] * N
def root(self, i):
... | Traceback (most recent call last):
File "/tmp/tmp0ovccqsm/tmpcuioc_4x.py", line 3, in <module>
N, M = [int(x) for x in input().split(' ')]
^^^^^^^
EOFError: EOF when reading a line
| |
s867463274 | p02573 | u619850971 | 1598793565 | Python | Python (3.8.2) | py | Runtime Error | 29 | 8928 | 911 | class UnionFind():
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = self.find(x)
y = ... | File "/tmp/tmpb5_t4s2i/tmp98g18oz2.py", line 5
def find(self, x):
^
IndentationError: unindent does not match any outer indentation level
| |
s808207731 | p02573 | u124864167 | 1598792169 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2214 | 230448 | 839 | n, m = map(int, input().split())
# l = [list(map(int, input().split())) for _ in range(m)]
class UnionFind:
def __init__(self, n):
self.__par = list(range(n))
self.__siz = [1]*len(self.__par)
def root(self, ix):
if self.__par[ix] == ix:
return ix
return self.root(s... | Traceback (most recent call last):
File "/tmp/tmp0r1_zils/tmpfsoq5ipw.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s484336098 | p02573 | u124864167 | 1598791949 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2213 | 230456 | 800 | n, m = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(m)]
class UnionFind:
def __init__(self, n):
self.__par = list(range(n))
self.__siz = [1]*len(self.__par)
def root(self, ix):
if self.__par[ix] == ix:
return ix
return self.root(sel... | Traceback (most recent call last):
File "/tmp/tmpp120evfj/tmp1yc3oel3.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s539178891 | p02573 | u514687406 | 1598791804 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 33172 | 860 | import sys
from collections import Counter
input = lambda: sys.stdin.readline().rstrip('\r\n')
# Disjoint Set Union
class DSU(object):
def __init__(self, n):
self.parent = [-1] * n
def find(self, key):
if self.parent[key] == -1:
return key
return self.find(self.parent[key... | Traceback (most recent call last):
File "/tmp/tmpvdqt142i/tmp1i21o_kg.py", line 41, in <module>
solve()
File "/tmp/tmpvdqt142i/tmp1i21o_kg.py", line 26, in solve
n, m = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s217811253 | p02573 | u347064383 | 1598791758 | Python | Python (3.8.2) | py | Runtime Error | 2208 | 92976 | 464 | # 接続最大クラスタのサイズが答え?
N, M = [int(x) for x in input().split(' ')]
from collections import defaultdict
d = defaultdict(set)
for i in range(M):
a, b = [int(x) for x in input().split(' ')]
d[a].add(b)
d[b].add(a)
def bfs(i, obs=set()):
# set_obs = d[i] | {i}
obs |= {i}
for j in d[i]:
if j ... | Traceback (most recent call last):
File "/tmp/tmpoyis2sc2/tmpfyy_f9hj.py", line 3, in <module>
N, M = [int(x) for x in input().split(' ')]
^^^^^^^
EOFError: EOF when reading a line
| |
s124468372 | p02573 | u991567869 | 1598791022 | Python | Python (3.8.2) | py | Runtime Error | 629 | 52092 | 564 | from collections import deque
n, m = map(int, input().split())
l = [[] for i in range(n)]
union = []
vis = [-1]*n
ans = 0
for i in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
l[a].append(b)
l[b].append(a)
q = deque()
def dfs(a):
if vis[a] == -1:
vis[a] = 0
temp.a... | Traceback (most recent call last):
File "/tmp/tmp7rtqeqlv/tmp13sfakjk.py", line 3, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s403768581 | p02573 | u613920660 | 1598790360 | Python | Python (3.8.2) | py | Runtime Error | 942 | 58888 | 790 | from collections import deque
N,M=map(int,input().strip().split())
l=list()
dp=[list() for _ in range(N)]
id=[-1 for _ in range(N)] #友人グループid 友人のいない者に-1をつける
for _ in range(M):
a,b=map(int,input().strip().split())
l.append((a,b))
dp[a-1].append(b)
dp[b-1].append(a)
id[a-1]=0
id[b-1]=0
i=1
c=[]
f... | Traceback (most recent call last):
File "/tmp/tmp6599r8hi/tmptmrbm7nf.py", line 2, in <module>
N,M=map(int,input().strip().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s939005647 | p02573 | u337626942 | 1598790269 | Python | PyPy3 (7.3.0) | py | Runtime Error | 86 | 76364 | 790 | import sys
sys.setrecursionlimit(10 ** 9)
class Union_Find:
def __init__(self, n):
self.root = [-1]*n
def find(self, x):
if self.root[x] < -1:
return x
else:
self.root[x] = self.find(self.root[x])
return root[x]
def unite(self, x, y):
... | Traceback (most recent call last):
File "/tmp/tmp5zjd9dvm/tmpdx_2guer.py", line 28, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s466351377 | p02573 | u337626942 | 1598790204 | Python | Python (3.8.2) | py | Runtime Error | 82 | 10656 | 747 | class Union_Find:
def __init__(self, n):
self.root = [-1]*n
def find(self, x):
if self.root[x] < -1:
return x
else:
self.root[x] = self.find(self.root[x])
return root[x]
def unite(self, x, y):
x = find(x)
y = find(y)
i... | Traceback (most recent call last):
File "/tmp/tmp89erukyn/tmpcdutonbr.py", line 25, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s399911102 | p02573 | u243061947 | 1598788903 | Python | Python (3.8.2) | py | Runtime Error | 843 | 19004 | 599 | class UnionFind:
def __init__(self, n):
self.parent = list(range(n))
def root(self, a):
if self.parent[a] == a:
return a
else:
self.parent[a] = self.root(self.parent[a])
return self.parent[a]
def unite(self, a, b):
a, b = self.root(a), self.root(b)
if a == b:
return
... | Traceback (most recent call last):
File "/tmp/tmp7a5bw5jj/tmp6zxmadh8.py", line 16, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s022770042 | p02573 | u585963734 | 1598788686 | Python | Python (3.8.2) | py | Runtime Error | 644 | 55448 | 562 | import collections as col
from collections import defaultdict as dd
d=dd(list)
N,M=map(int, input().split())
p=[-1]*N
cnt=[0]*N
for _ in range(M):
i,j=map(int, input().split())
if i>j:
i,j=j,i
d[i].append(j)
for i in d:
for j in d[i]:
if p[j-1]!=-1:
if p[i-1]==-1:
... | Traceback (most recent call last):
File "/tmp/tmpr8mzxg9v/tmpw032jk2k.py", line 6, in <module>
N,M=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s018416900 | p02573 | u585963734 | 1598788635 | Python | Python (3.8.2) | py | Runtime Error | 727 | 55496 | 581 | import collections as col
from collections import defaultdict as dd
d=dd(list)
N,M=map(int, input().split())
p=[-1]*N
cnt=[0]*N
for _ in range(M):
i,j=map(int, input().split())
if i>j:
i,j=j,i
d[i].append(j)
for i in d:
for j in d[i]:
print(i,j)
if p[j-1]!=-1:
if ... | Traceback (most recent call last):
File "/tmp/tmp3eysyj7x/tmppd58jzu9.py", line 6, in <module>
N,M=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s012413364 | p02573 | u703528810 | 1598787475 | Python | Python (3.8.2) | py | Runtime Error | 781 | 128760 | 493 | import sys
sys.setrecursionlimit(100000)
def DFS(i):
if done[i]:
ans[-1]+=1
done[i]=False
for g in G[i]:
if done[g]:
DFS(g)
else:
return p
N,M=map(int,input().split())
G=[[] for _ in range(N)]
done=[True for _ in range(N)]
for i in range(M):
a,b... | Traceback (most recent call last):
File "/tmp/tmpcpgyvxto/tmpmkt49cg_.py", line 14, in <module>
N,M=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s828337002 | p02573 | u501451051 | 1598786794 | Python | Python (3.8.2) | py | Runtime Error | 709 | 14032 | 490 | n,m = map(int,input().split())
root = [-1]*n
def find(x):
if root[x] < 0:
return x
else:
root[x] = find(root[x])
return root[x]
def unite(x,y):
x = find(x)
y = find(y)
if x == y:
return
root[x] += root[y]
root[y] = x
def size(x):
x = find(x)
retur... | Traceback (most recent call last):
File "/tmp/tmpjt2r36pn/tmpzc63qg5m.py", line 1, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s401706558 | p02573 | u794448346 | 1598786700 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 17664 | 548 | N,M = map(int,input().split())
f = []
for i in range(M):
A,B = map(int,input().split())
a = {A,B}
for j in range(len(f)):
if f[j] & a != set():
f[j] = f[j] | a
a = set()
if a != set():
f.append(a)
count = 1
while count > 0:
count = 0
for i in range(len(f)-... | Traceback (most recent call last):
File "/tmp/tmpj4jdekcb/tmp2rmrw92j.py", line 1, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s880884411 | p02573 | u794448346 | 1598786219 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 17736 | 548 | N,M = map(int,input().split())
f = []
for i in range(M):
A,B = map(int,input().split())
a = {A,B}
for i in range(len(f)):
if f[i] & a != set():
f[i] = f[i] | a
a = set()
if a != set():
f.append(a)
count = 1
while count > 0:
count = 0
for i in range(len(f)-... | Traceback (most recent call last):
File "/tmp/tmps0gpwuih/tmpdrmi36vp.py", line 1, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s245821744 | p02573 | u794448346 | 1598786147 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2211 | 231904 | 548 | N,M = map(int,input().split())
f = []
for i in range(M):
A,B = map(int,input().split())
a = {A,B}
for i in range(len(f)):
if f[i] & a != set():
f[i] = f[i] | a
a = set()
if a != set():
f.append(a)
count = 1
while count > 0:
count = 0
for i in range(len(f)-... | Traceback (most recent call last):
File "/tmp/tmpj0n6096u/tmpu624be1e.py", line 1, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s448949691 | p02573 | u243061947 | 1598785638 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 17524 | 725 | class UnionFind:
def __init__(self, n):
self.parent = list(range(n))
def root(self, a):
if self.parent[a] == a:
return a
self.parent[a] = self.root(self.parent[a])
return self.parent[a]
def unite(self, a, b):
if a > b:
a, b = b, a
a, b = self.root(a), self.root(b)
if a == b... | Traceback (most recent call last):
File "/tmp/tmphoccowg0/tmpsnf3fc7y.py", line 22, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s219891502 | p02573 | u821588465 | 1598785492 | Python | Python (3.8.2) | py | Runtime Error | 542 | 597364 | 551 | import sys
sys.setrecursionlimit(10**9)
n, m = map(int, input().split())
root = [-1] * n
def find_root(x):
if root[x] < 0:
return x
else:
root[x] == find_root(root[x])
return root[x]
def unite(x, y):
x = find_root(x)
y = find_root(y)
if x == y:
return
root[x]... | Traceback (most recent call last):
File "/tmp/tmpauco08m1/tmpajtifevb.py", line 4, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s483673027 | p02573 | u821588465 | 1598785241 | Python | Python (3.8.2) | py | Runtime Error | 542 | 11608 | 510 | n, m = map(int, input().split())
root = [-1] * n
def find_root(x):
if root[x] < 0:
return x
else:
root[x] == find_root(root[x])
return root[x]
def unite(x, y):
x = find_root(x)
y = find_root(y)
if x == y:
return
root[x] += root[y]
root[y] = x
def size(x):... | Traceback (most recent call last):
File "/tmp/tmp5owg76yg/tmpxcd18vs4.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s930043238 | p02573 | u912330011 | 1598781773 | Python | Python (3.8.2) | py | Runtime Error | 1541 | 81376 | 468 | N, M = map(int, input().split())
friends = {i: set() for i in range(N)}
for _ in range(M):
A, B = sorted(list(map(int, input().split())))
friends[A-1].add(B-1)
#print(friends)
ignore = set()
max = 0
def getAllFriends(il):
res = set()
for i in il:
res |= friends[i]
res |= getAllFriends(res)
return res
f... | Traceback (most recent call last):
File "/tmp/tmpbohztcor/tmp1aj0ie_k.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s724401868 | p02573 | u912330011 | 1598781673 | Python | Python (3.8.2) | py | Runtime Error | 806 | 79796 | 450 | N, M = map(int, input().split())
friends = {i: set() for i in range(N)}
for _ in range(M):
A, B = sorted(list(map(int, input().split())))
friends[A-1].add(B-1)
#print(friends)
ignore = set()
max = 0
def getAllFriends(il):
res = {friends[i] for i in il}
res |= getAllFriends(res)
return res
for i, ff in friend... | Traceback (most recent call last):
File "/tmp/tmpiktspf51/tmpdszh948d.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s996871493 | p02573 | u229950162 | 1598779678 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9808 | 811 | n, m = list(map(int, input().rstrip().split(" ")))
friendships = []
l = 0
for mm in range(m):
a, b = list(map(int, input().rstrip().split(" ")))
i_a = -1
i_b = -1
j_a = -1
j_b = -1
for ll in range(l):
if a in friendships[ll]:
j_a = friendships[ll].index(a)
i_a = ll
break
for ll in ra... | Traceback (most recent call last):
File "/tmp/tmpy2zbe75w/tmpd504aanu.py", line 1, in <module>
n, m = list(map(int, input().rstrip().split(" ")))
^^^^^^^
EOFError: EOF when reading a line
| |
s573020301 | p02573 | u161164709 | 1598779205 | Python | Python (3.8.2) | py | Runtime Error | 634 | 49924 | 958 | class union_find:
def __init__(self, node_num):
self.root_array = [-1] * node_num
def root(self, x):
if self.root_array[x] < 0:
return x
else:
return self.root_array[x]
def unite(self, x, y):
x = self.root(x)
y = self.root(y)
if x == ... | Traceback (most recent call last):
File "/tmp/tmp90eiaz1m/tmpuldz4yos.py", line 38, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s698935508 | p02573 | u243312682 | 1598779182 | Python | Python (3.8.2) | py | Runtime Error | 555 | 46144 | 820 | def main():
n, m = map(int, input().split())
g = [[] for i in [0]*(n+1)]
for _ in range(m):
a, b = map(int, input().split())
g[a].append(b)
g[b].append(a)
def bfs(n, m, adj):
visited = [0 for i in [0]*(n+1)]
ans = 1
for i in range(n+1):
if vis... | Traceback (most recent call last):
File "/tmp/tmpt55_031h/tmphjwlx9o0.py", line 32, in <module>
main()
File "/tmp/tmpt55_031h/tmphjwlx9o0.py", line 2, in main
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s601036891 | p02573 | u540627185 | 1598778687 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9060 | 1445 | import sys
sys.setrecursionlimit(10**7)
def input(): return sys.stdin.readline().rstrip()
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(s... | File "/tmp/tmplvurs_04/tmpmz11savg.py", line 33
def same(self, x, y):
IndentationError: unexpected indent
| |
s947272874 | p02573 | u540627185 | 1598778610 | Python | PyPy3 (7.3.0) | py | Runtime Error | 88 | 74740 | 1444 | import sys
sys.setrecursionlimit(10**7)
def input(): return sys.stdin.readline().rstrip()
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(s... | File "/tmp/tmp5o2eoa9r/tmp5z4ys9v_.py", line 33
def same(self, x, y):
IndentationError: unexpected indent
| |
s243781710 | p02573 | u243312682 | 1598777287 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 52048 | 1302 | from collections import deque
from copy import deepcopy
def main():
n, m = map(int, input().split())
adj = [[] for _ in range(n)]
for i in range(m):
a, b = map(lambda x: int(x) - 1, input().split())
adj[a].append(b)
adj[b].append(a)
dist = [-1] * n
q = deque([0])
dist[... | Traceback (most recent call last):
File "/tmp/tmp9oi1v21i/tmpb570mipe.py", line 53, in <module>
main()
File "/tmp/tmp9oi1v21i/tmpb570mipe.py", line 6, in main
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s955633778 | p02573 | u243312682 | 1598777052 | Python | Python (3.8.2) | py | Runtime Error | 2214 | 52304 | 1396 | from collections import deque
from copy import deepcopy
def main():
n, m = map(int, input().split())
adj = [[] for _ in range(n)]
for i in range(m):
a, b = map(lambda x: int(x) - 1, input().split())
print(a, b)
adj[a].append(b)
adj[b].append(a)
print(adj)
dist = [... | Traceback (most recent call last):
File "/tmp/tmpaxpuq6nx/tmpgjzj3a3b.py", line 58, in <module>
main()
File "/tmp/tmpaxpuq6nx/tmpgjzj3a3b.py", line 6, in main
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s957260762 | p02573 | u763550415 | 1598773244 | Python | Python (3.8.2) | py | Runtime Error | 28 | 8992 | 448 | N, M = map(int, input().split())
par = list(range(N))
rank = [1]*N
size = [1]*N
def find(x):
if par[x] == x:
return x
else:
return find(par[x])
def unite(x,y):
x = find(x)
y = find(y)
if x == y:
return
if rank[x]<rank[y]:
x,y = y,x
else:
par[y] = x
size[x] += size[y]
if rank[... | File "/tmp/tmp1nfna89w/tmp78gejj9l.py", line 22
par[y] = x
^
IndentationError: expected an indented block after 'else' statement on line 21
| |
s046816225 | p02573 | u763550415 | 1598773011 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 20852 | 437 | N, M = map(int, input().split())
par = list(range(N))
rank = [1]*N
size = [1]*N
def find(x):
if par[x] == x:
return x
else:
return find(par[x])
def unite(x,y):
x = find(x)
y = find(y)
if x == y:
return
if rank[x]<rank[y]:
x,y = y,x
par[y] = x
size[x] += size[y]
if rank[x]==rank... | Traceback (most recent call last):
File "/tmp/tmp5k3v_g1d/tmpeu07met9.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s631857125 | p02573 | u763550415 | 1598772191 | Python | Python (3.8.2) | py | Runtime Error | 2372 | 150064 | 562 | import sys
sys.setrecursionlimit(10**7)
def uf_find(x):
if x == p[x]:
return x
else:
p[x] = uf_find(p[x])
return p[x]
def uf_unite(x,y):
x = uf_find(x)
y = uf_find(y)
if x != y:
if r[y]>r[x]:
x,y = y,x
if r[x]==r[y]:
r[x]+= 1
p[y] = x
#print(r)
N, M = map(int, input... | Traceback (most recent call last):
File "/tmp/tmpuft9kg0i/tmpu2f4y_rh.py", line 23, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s438602924 | p02573 | u763550415 | 1598769694 | Python | Python (3.8.2) | py | Runtime Error | 2357 | 148516 | 506 | def uf_find(x):
z = x
while z != p[z]:
z = p[z]
p[x] = z
return z
def uf_unite(x,y):
global rand
x = uf_find(x)
y = uf_find(y)
if x != y:
rand += 1
if rand % 2 ==0:
p[y] = x
else:
p[x] = y
N, M = map(int, input().split())
p = list(range(N))
rand = 0
for i in range(M):
A,... | Traceback (most recent call last):
File "/tmp/tmppcttw230/tmplpgzogi8.py", line 19, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s831560889 | p02573 | u995163736 | 1598768645 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 150152 | 395 | n, m = map(int, input().split())
friends = set()
for i in range(m):
friends.add(tuple(map(int,input().split())))
#print(friends)
group = [set(friends.pop())]
for i,j in friends:
#print(group)
for g in group:
if (i in g) or (j in g):
g.add(i)
g.add(j)
break
else:
group.append({i,j})... | Traceback (most recent call last):
File "/tmp/tmp5w6fvfnu/tmp2ca0kbx1.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s599864876 | p02573 | u995163736 | 1598768404 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2236 | 1067380 | 369 | n, m = map(int, input().split())
friends = set()
for i in range(m):
friends.add(tuple(map(int,input().split())))
print(friends)
group = [set(friends.pop())]
for i,j in friends:
for g in group:
if (i in g) or (j in g):
g.add(i)
g.add(j)
else:
group.append({i,j})
#print(group)
ans = 0
f... | Traceback (most recent call last):
File "/tmp/tmpw8xcd9tk/tmppw5c65u2.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s664390403 | p02573 | u912330011 | 1598765689 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 80964 | 458 | N, M = map(int, input().split())
friends = {i: set() for i in range(N)}
for _ in range(M):
A, B = sorted(list(map(int, input().split())))
friends[A-1].add(B-1)
#print(friends)
ignore = set()
max = 0
def getAllFriends(i):
res = friends[i]
for f in friends[i]:
res = res|getAllFriends(f)
return res
for i, f... | Traceback (most recent call last):
File "/tmp/tmp6b1nsqwy/tmpghuaaewt.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s632037287 | p02573 | u912330011 | 1598765471 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 80340 | 450 | N, M = map(int, input().split())
friends = {i: set() for i in range(N)}
for _ in range(M):
A, B = sorted(list(map(int, input().split())))
friends[A-1].add(B-1)
#print(friends)
ignore = set()
max = 0
def getAllFriends(i):
res = friends[i]
for f in friends[i]:
res |= getAllFriends(f)
return res
for i, ff i... | Traceback (most recent call last):
File "/tmp/tmp4n0kzl4d/tmp2p0e1ydv.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s317782609 | p02573 | u912330011 | 1598764834 | Python | Python (3.8.2) | py | Runtime Error | 552 | 50964 | 410 | N, M = map(int, input().split())
friends = {i: [] for i in range(N)}
for _ in range(N):
A, B = sorted(map(int, input().split()))
friends[A].append(B)
ignore = []
max = 0
def getAllFriends(i):
res = []
for f in friends[i]:
res += getAllFriends(f)
return res
for i, ff in friends.items():
if i in ignore:... | Traceback (most recent call last):
File "/tmp/tmpgaqyxl_t/tmpy3ft_sir.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s345067006 | p02573 | u906501980 | 1598761427 | Python | Python (3.8.2) | py | Runtime Error | 476 | 106508 | 1043 | from numba import njit
class UnionFind:
__slots__ = ["data"]
def __init__(self, n=0):
self.data = [-1]*(n+1)
def root(self, x):
if self.data[x] < 0:
return x
self.data[x] = self.root(self.data[x])
return self.data[x]
def unite(self, x, y):
... | Traceback (most recent call last):
File "/tmp/tmpckkxvwx4/tmpgjaifotb.py", line 50, in <module>
main()
File "/root/miniconda3/envs/sandbox-runtime/lib/python3.11/site-packages/numba/core/dispatcher.py", line 468, in _compile_for_args
error_rewrite(e, 'typing')
File "/root/miniconda3/envs/sandbox-runtime/l... | |
s061454371 | p02573 | u571440314 | 1598760318 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2211 | 223216 | 3513 | #_______________________________________________________________#
def fact(x):
if x == 0:
return 1
else:
return x * fact(x-1)
def lower_bound(li, num):
answer = -1
start = 0
end = len(li)-1
while(start <= end):
middle = (end+start)//2
if li[middle] >= num:
answer = middle
end = middle - 1
else:
... | Traceback (most recent call last):
File "/tmp/tmp2qvpxvzv/tmpb6branuf.py", line 92, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s482948305 | p02573 | u751843916 | 1598759853 | Python | Python (3.8.2) | py | Runtime Error | 1946 | 297304 | 224 | import networkx as nx
n,m=map(int,input().split())
a=[[i for i in input().split()] for _ in range(m)]
g=nx.Graph()
for x in a:
g.add_edge(x[0],x[1])
print(len(sorted(nx.connected_components(g),key=len,reverse=True)[0])) | Traceback (most recent call last):
File "/tmp/tmpan1k0mle/tmprestz2oj.py", line 2, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s696126910 | p02573 | u992465933 | 1598757060 | Python | PyPy3 (7.3.0) | py | Runtime Error | 90 | 89456 | 651 | import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush
import collections
n,m = map(int, input().split())
par = [i for i in range(n)]
rank = [0]*n
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
... | Traceback (most recent call last):
File "/tmp/tmptnhsgznq/tmplx1dnxjw.py", line 10, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s824389117 | p02573 | u992465933 | 1598756912 | Python | PyPy3 (7.3.0) | py | Runtime Error | 472 | 90340 | 777 | import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush
import collections
n,m = map(int, input().split())
par = [i for i in range(n)]
rank = [0]*n
def find(x):
if par[x] == x:
return x
else:
par[x] = find(par[x])
... | Traceback (most recent call last):
File "/tmp/tmp_ogb7l61/tmpdcj9e223.py", line 10, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s440319577 | p02573 | u539692012 | 1598756165 | Python | Python (3.8.2) | py | Runtime Error | 1622 | 300792 | 104 | from networkx import*
_,*t=map(str.split,open(0))
print(max(1,*map(len,connected_components(Graph(t))))) | Traceback (most recent call last):
File "/tmp/tmp9paqt__3/tmpl2m7fqa8.py", line 2, in <module>
_,*t=map(str.split,open(0))
^^^^
ValueError: not enough values to unpack (expected at least 1, got 0)
| |
s138319034 | p02573 | u539692012 | 1598754863 | Python | Python (3.8.2) | py | Runtime Error | 1875 | 269520 | 250 | from networkx import*
n, m = map(int, input().split())
edges = [tuple(map(int, input().split())) for _ in range(m)]
G = Graph()
#G.add_nodes_from(range(1, n+1))
G.add_edges_from(edges)
ccs = connected_components(G)
ans = max(map(len, ccs))
print(ans) | Traceback (most recent call last):
File "/tmp/tmp57yv5lad/tmpvxhtkgep.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s273579478 | p02573 | u539692012 | 1598754624 | Python | Python (3.8.2) | py | Runtime Error | 677 | 80948 | 405 | from networkx import*
#print(max(map(len,connected_components(Graph(map(str.split,[*open(0)][1:]))))))
#(n,m),*t=map(str.split,open(0));print(max(map(len,connected_components(Graph(t[:int(m)])))))
n, m = map(int, input().split())
edges = [tuple(map(int, input().split())) for _ in range(m)]
G = Graph(range(1, n+1))
G.ad... | Traceback (most recent call last):
File "/tmp/tmpsqmyvr9j/tmp1sfq9725.py", line 4, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s975367007 | p02573 | u539692012 | 1598754525 | Python | Python (3.8.2) | py | Runtime Error | 1763 | 269340 | 374 | from networkx import*
#print(max(map(len,connected_components(Graph(map(str.split,[*open(0)][1:]))))))
#(n,m),*t=map(str.split,open(0));print(max(map(len,connected_components(Graph(t[:int(m)])))))
n, m = map(int, input().split())
edges = [tuple(map(int, input().split())) for _ in range(m)]
G = Graph(edges)
ccs = connec... | Traceback (most recent call last):
File "/tmp/tmpjfz2p0yh/tmpeyswz__u.py", line 4, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s623041271 | p02573 | u539692012 | 1598753673 | Python | Python (3.8.2) | py | Runtime Error | 2165 | 287076 | 143 | from networkx import*
f=lambda:tuple(map(int,input().split()))
n,m=f()
print(max(map(len,connected_components(DiGraph(f()for _ in range(m)))))) | Traceback (most recent call last):
File "/tmp/tmpua507ny3/tmpexhr73ar.py", line 3, in <module>
n,m=f()
^^^
File "/tmp/tmpua507ny3/tmpexhr73ar.py", line 2, in <lambda>
f=lambda:tuple(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s357927117 | p02573 | u539692012 | 1598753509 | Python | Python (3.8.2) | py | Runtime Error | 1768 | 255156 | 141 | from networkx import*
f=lambda:tuple(map(int,input().split()))
n,m=f()
print(max(map(len,connected_components(Graph(f()for _ in range(m)))))) | Traceback (most recent call last):
File "/tmp/tmpa4yvptoc/tmpfov8yw_k.py", line 3, in <module>
n,m=f()
^^^
File "/tmp/tmpa4yvptoc/tmpfov8yw_k.py", line 2, in <lambda>
f=lambda:tuple(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s330746180 | p02573 | u539692012 | 1598753306 | Python | Python (3.8.2) | py | Runtime Error | 321 | 53496 | 127 | from networkx import*
f=lambda:map(int,input().split())
n,m=f()
print(max(map(len,connected_components(f()for _ in range(m))))) | Traceback (most recent call last):
File "/tmp/tmppehet1e5/tmpsvapjhd_.py", line 3, in <module>
n,m=f()
^^^
File "/tmp/tmppehet1e5/tmpsvapjhd_.py", line 2, in <lambda>
f=lambda:map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s326434471 | p02573 | u132147074 | 1598753277 | Python | Python (3.8.2) | py | Runtime Error | 814 | 37480 | 645 | line = input()
N, M = [int(x) for x in line.split(" ")]
arr = [x for x in range(N + 1)]
def find(arr, num):
if arr[num] != num:
return find(arr, arr[num])
else:
return num
for i in range(M):
line = input()
people1, people2 = [int(x) for x in line.split(" ")]
parent1 = find(arr,people1)
parent... | Traceback (most recent call last):
File "/tmp/tmpdf9y9jb6/tmpy89f16jb.py", line 1, in <module>
line = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s822362075 | p02573 | u539692012 | 1598753034 | Python | Python (3.8.2) | py | Runtime Error | 1655 | 301636 | 114 | from networkx import*
(n,m),*t=map(str.split,open(0))
print(max(map(len,connected_components(Graph(t[:int(m)]))))) | Traceback (most recent call last):
File "/tmp/tmpwroisu09/tmp6_r7fek4.py", line 2, in <module>
(n,m),*t=map(str.split,open(0))
^^^^^^^^
ValueError: not enough values to unpack (expected at least 1, got 0)
| |
s468288415 | p02573 | u539692012 | 1598752667 | Python | Python (3.8.2) | py | Runtime Error | 1676 | 268228 | 101 | from networkx import*
print(max(map(len,connected_components(Graph(map(str.split,[*open(0)][1:])))))) | Traceback (most recent call last):
File "/tmp/tmphioln0on/tmpk4_p9sj1.py", line 2, in <module>
print(max(map(len,connected_components(Graph(map(str.split,[*open(0)][1:]))))))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: max() arg is an empty sequence
| |
s648369726 | p02573 | u712429027 | 1598752163 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 55404 | 900 | import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))
def dfs(x):
stack = [x]
visited = []
if checked[x] == 1:
retur... | Traceback (most recent call last):
File "/tmp/tmp38444smt/tmpf5e1jc6n.py", line 24, in <module>
n, m = inm()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s134951086 | p02573 | u581403769 | 1598748721 | Python | Python (3.8.2) | py | Runtime Error | 619 | 63560 | 517 | n, m = map(int, input().split())
par = [i + 1 for i in range(n)]
rank = [0] * n
size = [1] * n
def find(x):
if par[x - 1] == x:
return x
else:
return find(par[x - 1])
def union(x, y):
x = find(x)
y = find(y)
if rank[x] < rank[y]:
par[x] = y
size[x] += size[y]
e... | Traceback (most recent call last):
File "/tmp/tmptuod_30n/tmp7zcnkkqq.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s324581207 | p02573 | u273507800 | 1598747504 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9064 | 698 | def mian():
N, M = map(int, input().strip().split())
groups = []
for _ in range(M):
Ai, Bj = map(int, input().strip().split())
g_ai = -1
g_bj = -1
for i, group in enumerate(groups):
if Ai in group:
g_ai = i
if Bj in group:
g_bj = i
if g_ai > -1 and g_bj > -1:
break
if g_ai < 0 and... | Traceback (most recent call last):
File "/tmp/tmpt3to0c23/tmpm_cw54li.py", line 41, in <module>
main()
^^^^
NameError: name 'main' is not defined. Did you mean: 'min'?
| |
s346585620 | p02573 | u161693347 | 1598746961 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9096 | 2719 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_... | File "/tmp/tmp63dtx856/tmptfzplmez.py", line 84
tree.union(a - 1, b - 1)
TabError: inconsistent use of tabs and spaces in indentation
| |
s086826112 | p02573 | u075304271 | 1598746573 | Python | Python (3.8.2) | py | Runtime Error | 418 | 20012 | 925 | import math
import collections
import fractions
import itertools
import functools
import operator
import bisect
def solve():
n, m = map(int, input().split())
group = []
done = [-1]*n
num = 0
for i in range(m):
a, b = map(lambda x:int(x)-1, input().split())
if done[a] != -1:
... | Traceback (most recent call last):
File "/tmp/tmp30gf5sva/tmpefoh3f8y.py", line 37, in <module>
solve()
File "/tmp/tmp30gf5sva/tmpefoh3f8y.py", line 10, in solve
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s763433983 | p02573 | u075304271 | 1598746337 | Python | Python (3.8.2) | py | Runtime Error | 432 | 19792 | 938 | import math
import collections
import fractions
import itertools
import functools
import operator
import bisect
def solve():
n, m = map(int, input().split())
group = []
done = [-1]*n
num = 0
for i in range(m):
a, b = map(lambda x:int(x)-1, input().split())
if done[a] != -1:
... | Traceback (most recent call last):
File "/tmp/tmpe6qv65u8/tmpl9mgz9up.py", line 37, in <module>
solve()
File "/tmp/tmpe6qv65u8/tmpl9mgz9up.py", line 10, in solve
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s907064176 | p02573 | u102655885 | 1598746284 | Python | Python (3.8.2) | py | Runtime Error | 885 | 12216 | 1682 | # UnionFind
# 配列で、子のID番目:(親のID), 親のID番目:(その塊の-サイズ)
# Union Findを使う
class UnionFind:
def __init__(self, size):
self.parent_indexes = [-1] * size
def find_parent(self, n):
# print(self.parent_indexes[n])
if self.parent_indexes[n] < 0:
return n
# print('hewe')
... | Traceback (most recent call last):
File "/tmp/tmpu2ri5zna/tmpgrdq01q6.py", line 43, in <module>
n, m = map(lambda x: int(x), input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s820218478 | p02573 | u102655885 | 1598746243 | Python | Python (3.8.2) | py | Runtime Error | 925 | 14740 | 1812 | # UnionFind
# 配列で、子のID番目:(親のID), 親のID番目:(その塊の-サイズ)
# Union Findを使う
class UnionFind:
def __init__(self, size):
self.parent_indexes = [-1] * size
def find_parent(self, n):
# print(self.parent_indexes[n])
if self.parent_indexes[n] < 0:
return n
# print('hewe')
... | Traceback (most recent call last):
File "/tmp/tmpytw8pxox/tmp5wa3vbo8.py", line 43, in <module>
n, m = map(lambda x: int(x), input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s961640704 | p02573 | u102655885 | 1598746158 | Python | Python (3.8.2) | py | Runtime Error | 926 | 15004 | 1879 | # UnionFind
# 配列で、子のID番目:(親のID), 親のID番目:(その塊の-サイズ)
# Union Findを使う
class UnionFind:
def __init__(self, size):
self.parent_indexes = [-1] * size
def find_parent(self, n):
# print(self.parent_indexes[n])
if self.parent_indexes[n] < 0:
return n
# print('hewe')
... | Traceback (most recent call last):
File "/tmp/tmpuwhck366/tmpbpv1qy54.py", line 43, in <module>
n, m = map(lambda x: int(x), input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s325575647 | p02573 | u075304271 | 1598746145 | Python | Python (3.8.2) | py | Runtime Error | 425 | 19936 | 896 | import math
import collections
import fractions
import itertools
import functools
import operator
import bisect
def solve():
n, m = map(int, input().split())
group = []
done = [-1]*n
num = 0
for i in range(m):
a, b = map(lambda x:int(x)-1, input().split())
if done[a] != -1:
... | Traceback (most recent call last):
File "/tmp/tmpyrnnluef/tmpd39otj3u.py", line 36, in <module>
solve()
File "/tmp/tmpyrnnluef/tmpd39otj3u.py", line 10, in solve
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.