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
s005115557
p02573
u940652437
1599423187
Python
Python (3.8.2)
py
Runtime Error
2208
100992
297
n,m = map(int,input().split()) tomo =[] a = list(map(int,input().split())) tomo += a for i in range(m-1): a,b=map(int,input().split()) for j in range(len(tomo)): if(a == tomo[j] or b == tomo[j]): tomo.append(a) tomo.append(b) ans = set(tomo) print(len(ans))
Traceback (most recent call last): File "/tmp/tmp3morc24y/tmpmzk5ei1y.py", line 1, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s739704582
p02573
u940652437
1599423052
Python
Python (3.8.2)
py
Runtime Error
2208
95272
309
n,m = map(int,input().split()) tomo =[] a = list(map(int,input().split())) tomo += a for i in range(m-1): a,b=map(int,input().split()) for j in range(len(tomo)): if(a == tomo[j] or b == tomo[j]): tomo.append(a) tomo.append(b) ans = set(tomo) #print(ans) print(len(ans))
Traceback (most recent call last): File "/tmp/tmp2xlbexhy/tmp7k8h2qzo.py", line 1, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s708860579
p02573
u940652437
1599423028
Python
Python (3.8.2)
py
Runtime Error
2208
98648
313
n,m = map(int,input().split()) tomo =[] a = list(map(int,input().split())) tomo += a for i in range(m-1): a,b=map(int,input().split()) for j in range(len(tomo)): if(a == tomo[j] or b == tomo[j]): tomo.append(a) tomo.append(b) ans = set(tomo) print(ans) print(len(ans))
Traceback (most recent call last): File "/tmp/tmp5b15j_aj/tmpgi9pxij1.py", line 1, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s781198483
p02573
u100858029
1599422069
Python
Python (3.8.2)
py
Runtime Error
780
214040
827
''' We can show that if u and v belong to the same connected component, then they are friends w/ each other So everyone in a given connected component is friends with one another So everyone in a given connected component must be separated into different groups If we have a CC of with sz nodes in it, then we need ...
Traceback (most recent call last): File "/tmp/tmphrnbeds3/tmpt13rfb4n.py", line 13, in <module> n, m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s192587049
p02573
u056358163
1599408632
Python
Python (3.8.2)
py
Runtime Error
2207
51192
879
N, M = map(int, input().split()) group_list = [] group_index = [0] * N for _ in range(M): a, b = map(int, input().split()) if group_index[a-1] == 0 and group_index[b-1] == 0: group_index[a-1] = len(group_list) + 1 group_index[b-1] = len(group_list) + 1 group_list.append(set([a, b])) ...
Traceback (most recent call last): File "/tmp/tmpcuytxy5l/tmpq508da59.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s005697417
p02573
u274080981
1599408033
Python
Python (3.8.2)
py
Runtime Error
2216
386960
592
n, m = map(int, input().split()) ans=0 relationships = [list(map(int, input().split())) for i in range(m)] for i in range(m): relationships[i].sort() relationships.sort() groups = [] groups.append(set(relationships[0])) for i in range(1, m): for j in range(len(groups)): if relationships[i][0] in groups...
Traceback (most recent call last): File "/tmp/tmphhjskt6t/tmp4zsee3t4.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s451375040
p02573
u056358163
1599407721
Python
Python (3.8.2)
py
Runtime Error
735
47472
989
N, M = map(int, input().split()) A = [] B = [] for _ in range(M): a, b = map(int, input().split()) A.append(a) B.append(b) group_list = [] group_index = [0] * N last_group = 1 for a, b in zip(A, B): if group_index[a-1] == 0 and group_index[b-1] == 0: group_index[a-1] = last_group gro...
Traceback (most recent call last): File "/tmp/tmp3ymxiu10/tmpa1llnz1h.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s888148773
p02573
u351480677
1599407559
Python
Python (3.8.2)
py
Runtime Error
441
50208
759
import sys class UnionFind(): def __init__(self, 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.fin...
Traceback (most recent call last): File "/tmp/tmpklobzxg4/tmp2l2qmw4k.py", line 27, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s430096521
p02573
u056358163
1599406922
Python
Python (3.8.2)
py
Runtime Error
2206
46272
696
from collections import defaultdict from itertools import combinations N, M = map(int, input().split()) A = [] B = [] for _ in range(M): a, b = map(int, input().split()) A.append(a) B.append(b) group_list = [] #D = defaultdict(set) for a, b in zip(A, B): if len(group_list) == 0: group_list.ap...
Traceback (most recent call last): File "/tmp/tmpm_3h9sit/tmpgqass2wm.py", line 4, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s320070731
p02573
u549579601
1599406880
Python
PyPy3 (7.3.0)
py
Runtime Error
789
146976
502
import collections n, m = map(int, input().split()) A = [0] * n mamimum = 1 B = [] C = [] for i in range(m): b, c = map(int, input().split()) B.append(b) C.append(c) D = zip(B, C) D = sorted(D) B, C = zip(*D) for i, j in zip(B, C): i -= 1 j -= 1 if A[i] == 0 and A[j] == 0: A[i] = ...
Traceback (most recent call last): File "/tmp/tmppvzpfe7_/tmpf3565s5q.py", line 3, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s637505266
p02573
u100858029
1599404759
Python
Python (3.8.2)
py
Runtime Error
28
9012
823
''' We can show that if u and v belong to the same connected component, then they are friends w/ each other So everyone in a given connected component is friends with one another So everyone in a given connected component must be separated into different groups If we have a CC of with sz nodes in it, then we need ...
Traceback (most recent call last): File "/tmp/tmp4nnste8y/tmp4v_jafen.py", line 11, in <module> sys.setrecursionlimit(4e5) TypeError: 'float' object cannot be interpreted as an integer
s315122143
p02573
u100858029
1599404637
Python
PyPy3 (7.3.0)
py
Runtime Error
579
154360
784
''' We can show that if u and v belong to the same connected component, then they are friends w/ each other So everyone in a given connected component is friends with one another So everyone in a given connected component must be separated into different groups If we have a CC of with sz nodes in it, then we need ...
Traceback (most recent call last): File "/tmp/tmphslyq8a7/tmpw42qem9y.py", line 10, in <module> n, m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s600087716
p02573
u666721654
1599400574
Python
PyPy3 (7.3.0)
py
Runtime Error
161
67944
863
import numpy as np class UnionFind: def __init__(self, sz: int): self._par: np.array = np.full(sz + 1, -1) def root(self, a: int): if self._par[a] < 0: return a self._par[a] = self.root(self._par[a]) return self._par[a] def size(self, a: int): retur...
Traceback (most recent call last): File "/tmp/tmpv_l2tyah/tmptasi_3wj.py", line 26, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s995174208
p02573
u427427681
1599399613
Python
Python (3.8.2)
py
Runtime Error
2228
642836
732
N,M = tuple(map(int,input().split())) # matchlist = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(M)] #最大のグループの大きさを出す friendlist = list(range(N)) # [所属先,[所属メンバー]] gplist = [[i] for i in range(N)] def getgroup(a): A = friendlist[a] if A == a: return a else: return getgroup(A)...
Traceback (most recent call last): File "/tmp/tmp4y6epgf0/tmpku9ke3w2.py", line 1, in <module> N,M = tuple(map(int,input().split())) ^^^^^^^ EOFError: EOF when reading a line
s772519999
p02573
u894521144
1599392284
Python
Python (3.8.2)
py
Runtime Error
32
9412
1401
from collections import Counter # 再帰回数のエラー?と思われるので再帰上限を変更 10**3 → 10**9 # 変更したら RE がなくなったのでおそらくこれのせいで通らなかった import sys sys.setrecursionlimit(10 ** 9) lst = [n for n in range(N)] # 初期値はすべてがそれぞれ根である状態 def get_root(x): # 根を得る関数 if lst[x] == x: # それ自身が根である場合 return x else: # 根が別のものである場合 lst[...
Traceback (most recent call last): File "/tmp/tmpbt5yj7kf/tmp5e5qlxxf.py", line 8, in <module> lst = [n for n in range(N)] # 初期値はすべてがそれぞれ根である状態 ^ NameError: name 'N' is not defined
s867547639
p02573
u449775273
1599391990
Python
Python (3.8.2)
py
Runtime Error
2206
26456
384
n, m =map(int,input().split()) l = [{int(x) for x in input().split()}] ans = 0 for _ in range(m-1): a = {int(x) for x in input().split()} for j, s in enumerate(l): if s & a: l[j] |= a ans = max(ans, len(l[j])) if ans >= n: print(ans) ex...
Traceback (most recent call last): File "/tmp/tmpkb_fpg0o/tmpoxonlp99.py", line 1, in <module> n, m =map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s683724664
p02573
u894521144
1599391862
Python
Python (3.8.2)
py
Runtime Error
828
51932
1118
from collections import Counter def main(N, M, C): lst = [n for n in range(N)] # 初期値はすべてがそれぞれ根である状態 def get_root(x): # 根を得る関数 if lst[x] == x: # それ自身が根である場合 return x else: # 根が別のものである場合 lst[x] = get_root(lst[x]) # 経路圧縮あり (ある種「メモ再帰化」) return lst[x] ...
Traceback (most recent call last): File "/tmp/tmp8mmmjfmp/tmp6y8dx_2e.py", line 26, in <module> N, M = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s330886107
p02573
u894521144
1599391748
Python
Python (3.8.2)
py
Runtime Error
2207
53100
1120
from collections import Counter def main(N, M, C): lst = [n for n in range(N)] # 初期値はすべてがそれぞれ根である状態 def get_root(x): # 根を得る関数 if lst[x] == x: # それ自身が根である場合 return x else: # 根が別のものである場合 # lst[x] = get_root(lst[x]) # 経路圧縮あり (ある種「メモ再帰化」) # return lst[x] ...
Traceback (most recent call last): File "/tmp/tmp3ujs_vrn/tmp90tdsu6f.py", line 26, in <module> N, M = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s809968498
p02573
u449775273
1599391063
Python
Python (3.8.2)
py
Runtime Error
2206
26268
310
n, m =map(int,input().split()) l = [{int(x) for x in input().split()}] ans = 0 for _ in range(m-1): a = {int(x) for x in input().split()} for j, s in enumerate(l): if s & a: l[j] |= a break else: l.append(a) for s in l: ans = max(ans, len(s)) print(ans)
Traceback (most recent call last): File "/tmp/tmpfe3lol7v/tmp4jgy2_5f.py", line 1, in <module> n, m =map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s056815429
p02573
u408375121
1599375962
Python
Python (3.8.2)
py
Runtime Error
254
56268
392
n, m = map(int, input().split()) group = [set() for _ in range(n+1)] for _ in range(m): a, b = map(int, input()) group[a].add(b) group[b].add(a) lst = [True] * (n+1) ans = 0 for i in range(1, n+1): if lst[i]: friends = group[i] for friend in group[i]: friends = friends | group[friend] lst[f...
Traceback (most recent call last): File "/tmp/tmpxjw0cpks/tmp133wcqsj.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s860565986
p02573
u427427681
1599342387
Python
Python (3.8.2)
py
Runtime Error
2207
47832
940
N,M = tuple(map(int,input().split())) matchlist = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(M)] #最大のグループの大きさを出す friendlist = [0 for i in range(N)] gplist = [[-1]] def match(ab): a,b=ab gpa=friendlist[a] gpb=friendlist[b] if bool(gpa) and gpa==gpb: return elif not bool(gpa...
Traceback (most recent call last): File "/tmp/tmpgquh9syh/tmplefv196i.py", line 1, in <module> N,M = tuple(map(int,input().split())) ^^^^^^^ EOFError: EOF when reading a line
s990115774
p02573
u427427681
1599342056
Python
Python (3.8.2)
py
Runtime Error
2206
43888
948
N,M = tuple(map(int,input().split())) matchlist = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(M)] #最大のグループの大きさを出す friendlist = [0 for i in range(N)] gplist = [[]] def match(ab): a,b=ab gpa=friendlist[a] gpb=friendlist[b] if bool(gpa) and gpa==gpb: return elif not bool(gpa) ...
Traceback (most recent call last): File "/tmp/tmpdsr0nrun/tmp88bqx5ug.py", line 1, in <module> N,M = tuple(map(int,input().split())) ^^^^^^^ EOFError: EOF when reading a line
s954933300
p02573
u200243669
1599318952
Python
Python (3.8.2)
py
Runtime Error
537
14444
722
class UnionFind(): def __init__(self,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) ...
Traceback (most recent call last): File "/tmp/tmpacix_xk3/tmp3jpt9t3c.py", line 24, in <module> N,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s153169054
p02573
u229950162
1599308223
Python
Python (3.8.2)
py
Runtime Error
2373
147528
543
n, m = list(map(int, input().rstrip().split(" "))) members = [1 for i in range(n)] max_idx = 0 for mm in range(m): print(members) a0, b0 = list(map(int, input().rstrip().split(" "))) a = a0 b = b0 while members[a-1] < 0: a = -members[a-1] members[a0-1] = -a while members[b-1] < 0: b = -members[b...
Traceback (most recent call last): File "/tmp/tmp181juzs5/tmp6vnwdeya.py", line 1, in <module> n, m = list(map(int, input().rstrip().split(" "))) ^^^^^^^ EOFError: EOF when reading a line
s271805546
p02573
u229950162
1599306985
Python
Python (3.8.2)
py
Runtime Error
2206
10828
478
n, m = list(map(int, input().rstrip().split(" "))) members = [1 for i in range(n)] max_idx = 0 for mm in range(m): a0, b0 = list(map(int, input().rstrip().split(" "))) a = a0 b = b0 while members[a-1] < 0: a = -members[a-1] while members[b-1] < 0: b = -members[b-1] members[a0-1] = -a members[b0-1]...
Traceback (most recent call last): File "/tmp/tmpo7twts2h/tmpombk6mlc.py", line 1, in <module> n, m = list(map(int, input().rstrip().split(" "))) ^^^^^^^ EOFError: EOF when reading a line
s821148507
p02573
u407778590
1599304969
Python
Python (3.8.2)
py
Runtime Error
907
16304
529
def get_group_root(x): if parent[x] < 0: return x return get_group_root(parent[x]) [N, M] = map(int, input().split()) parent = [-1] * N # 親の友人 for i in range(M): [A,B] = map(int, input().split()) A -= 1 B -= 1 groupA = get_group_root(A) groupB = get_group_root(B) if groupA =...
Traceback (most recent call last): File "/tmp/tmpq4_io3cf/tmpc58hys8y.py", line 7, in <module> [N, M] = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s201853877
p02573
u808817704
1599297211
Python
PyPy3 (7.3.0)
py
Runtime Error
515
168432
924
from collections import Counter class UnionFind: def __init__(self, N: int) -> None: self.par = [i for i in range(N)] def root(self, x: int) -> bool: if self.par[x] == x: #親が自分自身なら頂点 return x else: self.par[x] = self.root(self.par[x]) return self...
Traceback (most recent call last): File "/tmp/tmpmi5ucf3v/tmpkhr29qsx.py", line 38, in <module> main() File "/tmp/tmpmi5ucf3v/tmpkhr29qsx.py", line 27, in main N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s363256694
p02573
u617384447
1599275811
Python
PyPy3 (7.3.0)
py
Runtime Error
2212
228692
456
N, M = map(int, input().split()) # M pieces of information for N people # if a parent, -1 * number of members # else index of its parent UF = [-1] * N def root(x): if UF[x] < 0: return x else: return root(UF[x]) for _ in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 ...
Traceback (most recent call last): File "/tmp/tmpnkkgr05m/tmpqr8477px.py", line 2, in <module> N, M = map(int, input().split()) # M pieces of information for N people ^^^^^^^ EOFError: EOF when reading a line
s543524616
p02573
u522945737
1599267778
Python
Python (3.8.2)
py
Runtime Error
25
8916
1427
import copy def dfs(k,E,A,B): # print("lenA is "+str(len(A))) for i in range(len(A)): # print("i is "+str(i)) # print("k is "+str(k)) if i >= len(A): # print("damedesu") break # print("A[i] is "+str(A[i])) # print("B[i] is "+str(B[i])) if k == ...
File "/tmp/tmphxgc9fno/tmpnlocd1si.py", line 18 else: ^ IndentationError: expected an indented block after 'if' statement on line 16
s035622320
p02573
u188305619
1599258095
Python
Python (3.8.2)
py
Runtime Error
2206
13052
582
N, M = map(int,input().split()) pairs = [] for i in [0]*M: inp = sorted(list(map(int,input().split()))) if inp not in pairs: pairs.append(inp) def solver(N,M,pairs): group_list = [] for i in pairs: pair = sorted(i) for j in range(len(group_list)): if pair[1] in group_...
Traceback (most recent call last): File "/tmp/tmpx2m5qocd/tmp2nnwpcn8.py", line 1, in <module> N, M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s924497862
p02573
u719260857
1599252294
Python
Python (3.8.2)
py
Runtime Error
994
187260
433
import collections import sys import resource sys.setrecursionlimit(200000) n, m = map(int, input().split(' ')) f = [x for x in range(n)] def find(x): if f[x] == x: return x root = find(f[x]) f[x] = root return root for i in range(m): a, b = map(int, input().split(' ')) a -= 1 b -= 1 if find(a) ...
Traceback (most recent call last): File "/tmp/tmp3i_t9znz/tmpn3yki16h.py", line 6, in <module> n, m = map(int, input().split(' ')) ^^^^^^^ EOFError: EOF when reading a line
s907722466
p02573
u533232830
1599248045
Python
PyPy3 (7.3.0)
py
Runtime Error
487
111724
537
from collections import deque N, M = map(int, input().split()) friends = [[] for _ in range(N)] for _ in range(M): a, b = map(int, input().split()) a, b = a-1, b-1 friends[a].append(b) friends[b].append(a) check = [False] * N ans = 0 for i in range(N): if check[i] == False: check[i] = True D = deq...
Traceback (most recent call last): File "/tmp/tmpvdeoiize/tmpz8hmol9d.py", line 3, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s481065982
p02573
u533232830
1599247985
Python
PyPy3 (7.3.0)
py
Runtime Error
433
111692
536
from collections import deque N, M = map(int, input().split()) friends = [[] for _ in range(N)] for _ in range(M): a, b = map(int, input().split()) a, b = a-1, b-1 friends[a].append(b) friends[b].append(a) check = [False] * N ans = 0 for i in range(N): if check[i] == False: check[i] = True D = deq...
Traceback (most recent call last): File "/tmp/tmpvrfb5w1g/tmp4f16un36.py", line 3, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s044609642
p02573
u216069198
1599246274
Python
Python (3.8.2)
py
Runtime Error
735
44696
488
n,m=map(int,input().split()) g=[] for i in range(n+10): g.append([]) for i in range(m): a,b=map(int,input().split()) g[a].append(b) g[b].append(a) ans=0 vis=[False]*(n+10) #vis[1]=True def dfs(n): ret=0 if vis[n]: return 0 else: vis[n]=True ret+=1 for i i...
Traceback (most recent call last): File "/tmp/tmp6g4lnv2q/tmp6xxeax74.py", line 1, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s664743096
p02573
u216069198
1599246196
Python
Python (3.8.2)
py
Runtime Error
728
44692
486
n,m=map(int,input().split()) g=[] for i in range(n+1): g.append([]) for i in range(m): a,b=map(int,input().split()) g[a].append(b) g[b].append(a) ans=0 vis=[False]*(n+1) #vis[1]=True def dfs(n): ret=0 if vis[n]: return 0 else: vis[n]=True ret+=1 for i in ...
Traceback (most recent call last): File "/tmp/tmp8fclgh6w/tmpnkhrqvtn.py", line 1, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s651208807
p02573
u719260857
1599239228
Python
Python (3.8.2)
py
Runtime Error
723
31916
423
import collections import sys n, m = map(int, input().split(' ')) if m == 0: print(1) sys.exit() f = [x for x in range(n)] def find(x): if f[x] == x: return x root = find(f[x]) f[x] = root return root for i in range(m): a, b = map(int, input().split(' ')) a -= 1 b -= 1 if find(a) != find(b)...
Traceback (most recent call last): File "/tmp/tmp3k3omg6j/tmpluwr0fpb.py", line 4, in <module> n, m = map(int, input().split(' ')) ^^^^^^^ EOFError: EOF when reading a line
s242481920
p02573
u719260857
1599239097
Python
Python (3.8.2)
py
Runtime Error
765
32228
385
import collections n, m = map(int, input().split(' ')) f = [x for x in range(n)] def find(x): if f[x] == x: return x root = find(f[x]) f[x] = root return root for i in range(m): a, b = map(int, input().split(' ')) a -= 1 b -= 1 if find(a) != find(b): f[find(a)] = find(b) for i in range(n): ...
Traceback (most recent call last): File "/tmp/tmp3acwoqdy/tmpettr7if2.py", line 3, in <module> n, m = map(int, input().split(' ')) ^^^^^^^ EOFError: EOF when reading a line
s077397957
p02573
u945157177
1599232856
Python
PyPy3 (7.3.0)
py
Runtime Error
564
82844
656
def readInt(): return list(map(int, input().split())) n, m = readInt() root = [-1] * n def r(x): # print("root[x]=",root[x]) if root[x] < 0: # print("r(x)=",x) return x else: root[x] = r(root[x]) # print(root[x]) return root[x] def unite(x, y): x = r(x) ...
Traceback (most recent call last): File "/tmp/tmp64mz5mvy/tmpma_u86b9.py", line 4, in <module> n, m = readInt() ^^^^^^^^^ File "/tmp/tmp64mz5mvy/tmpma_u86b9.py", line 2, in readInt return list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s370034908
p02573
u896726004
1599231581
Python
Python (3.8.2)
py
Runtime Error
589
14564
1635
class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n # xの属する木の根を求める def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] # xとyの属す...
Traceback (most recent call last): File "/tmp/tmp5wwb41hh/tmpv5tq2ywj.py", line 55, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s455658049
p02573
u334703235
1599231383
Python
Python (3.8.2)
py
Runtime Error
2260
1597660
878
import numpy as np N,M = map(int,input().split()) li = np.zeros((N,N)).tolist() for i in range(M): Ai, Bi =map(int,input().split()) li[Ai-1][Bi-1] = 1 li[Bi-1][Ai-1] = 1 que = list() idx = list(range(0,N)) #index list for second loop maxC = 0 while True: if len(idx) == 0: break startfri...
Traceback (most recent call last): File "/tmp/tmpidl_gz5i/tmpo10zf5b3.py", line 2, in <module> N,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s266476395
p02573
u334703235
1599231295
Python
Python (3.8.2)
py
Runtime Error
2247
1598056
877
import numpy as np N,M = map(int,input().split()) li = np.zeros((N,N)).tolist() for i in range(M): Ai, Bi =map(int,input().split()) li[Ai-1][Bi-1] = 1 li[Bi-1][Ai-1] = 1 que = list() idx = list(range(0,N)) #index list for second loop maxC = 0 while True: if len(idx) == 0: break startfri...
Traceback (most recent call last): File "/tmp/tmpa4k2k22_/tmpokid5x_5.py", line 2, in <module> N,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s545636351
p02573
u334703235
1599231269
Python
PyPy3 (7.3.0)
py
Runtime Error
95
74784
877
import numpy as np N,M = map(int,input().split()) li = np.zeros((N,N)).tolist() for i in range(M): Ai, Bi =map(int,input().split()) li[Ai-1][Bi-1] = 1 li[Bi-1][Ai-1] = 1 que = list() idx = list(range(0,N)) #index list for second loop maxC = 0 while True: if len(idx) == 0: break startfri...
Traceback (most recent call last): File "/tmp/tmp38hkb_np/tmp9j5o89ph.py", line 2, in <module> N,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s700301702
p02573
u458967973
1599227462
Python
Python (3.8.2)
py
Runtime Error
2373
150528
694
n, m = map(int, input().split()) data2 = [] for i in range(m): data2.append(input().split()) graph = [[] for i in range(n)] for i in range(m): a, b = map(lambda z: int(z) - 1, data2[m]) graph[a].append(b) graph[b].append(a) print(graph) size = [0 for i in range(n)] check = [True for i in range(n)] fo...
Traceback (most recent call last): File "/tmp/tmp2d_7y1jq/tmp7er25nvb.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s059349898
p02573
u472696272
1599227037
Python
Python (3.8.2)
py
Runtime Error
433
16076
616
n,m = map(int,input().split()) friendship = [0] * (n+1) set_mark = 0 for i in range(m): p1,p2 = map(int,input().split()) if friendship[p1] == 0 and friendship[p2] == 0: set_mark += 1 friendship[p1] = friendship[p2] = set_mark elif friendship[p1] == 0 and friendship[p2] != 0: friendship[p1] = friends...
Traceback (most recent call last): File "/tmp/tmpbqnc32wr/tmpy0vq1oci.py", line 1, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s815036084
p02573
u472696272
1599226995
Python
Python (3.8.2)
py
Runtime Error
464
15832
614
n,m = map(int,input().split()) friendship = [0] * (n+1) set_mark = 0 for i in range(m): p1,p2 = map(int,input().split()) if friendship[p1] == 0 and friendship[p2] == 0: set_mark += 1 friendship[p1] = friendship[p2] = set_mark elif friendship[p1] == 0 and friendship[p2] != 0: friendship[p1] = friends...
Traceback (most recent call last): File "/tmp/tmpvr0di4d4/tmp09ntv8a7.py", line 1, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s015625030
p02573
u113310313
1599226030
Python
Python (3.8.2)
py
Runtime Error
2207
52448
555
from collections import defaultdict N, M = map(int, input().split()) F = defaultdict(list) max_size = 0 for _ in range(M): A, B = map(int, input().split()) if B not in F[A]: F[A].append(B) if A not in F[B]: F[B].append(A) def dfs(i): vis.append(i) size = 0 for j in F[i]: ...
Traceback (most recent call last): File "/tmp/tmph77b6reo/tmpfhxyvl0c.py", line 3, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s170645988
p02573
u197909530
1599212329
Python
PyPy3 (7.3.0)
py
Runtime Error
86
74720
503
#ABC177 #D - Friends N,M=map(int,input().split()) friends=[] member=[] for i in range(M): x,y=map(lambda x :int(x)-1,input().split()) j=sorted[x,y] if j in friends: friends.append(j) member.extend([x,y]) member2=[i for i in set(member) if member.count(i)>1 ] for i in member2: a=[k for j in friend...
Traceback (most recent call last): File "/tmp/tmp6ubb13x0/tmp8w4yld84.py", line 4, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s449899695
p02573
u197909530
1599207831
Python
PyPy3 (7.3.0)
py
Runtime Error
2212
269396
540
#ABC177 #D - Friends N,M=map(int,input().split()) friends=[[i] for i in range(N)] member=[] for i in range(M): x,y=map(lambda x :int(x)-1,input().split()) friends[x].append(y) friends[y].append(x) member.extend([x,y]) friends=[sorted(set(i)) for i in friends if len(i)!=1] member=sorted(set(member)) for i ...
Traceback (most recent call last): File "/tmp/tmptlu7etdo/tmpkivnuw_n.py", line 4, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s606673727
p02573
u417365712
1599183063
Python
Python (3.8.2)
py
Runtime Error
327
57280
1178
class UnionFind(): def __init__(self, n): self._n = n self._table = [-1]*n def _root(self, x): stack = [] while self._table[x] >= 0: stack.append(x) x = self._table[x] for y in stack: self._table[y] = x return x def un...
Traceback (most recent call last): File "/tmp/tmpjeazm3am/tmph2jved09.py", line 39, in <module> n, m, *AB = map(int, open(0).read().split()) ^^^^^^^^^ ValueError: not enough values to unpack (expected at least 2, got 0)
s484487682
p02573
u237380797
1599175897
Python
PyPy3 (7.3.0)
py
Runtime Error
91
74592
1730
from collections import defaultdict g=defaultdict(set) n,m=map(int,input().split()) count=n visited = [True]*(n+1) visited1=[False]*(n+1) for i in range(m): u,v=map(int,input().split()) visited[u]=False visited[v]=False if visited1[u]==False: visited1[u]=True count-=1 if visited1[v]...
File "/tmp/tmp27kubm_m/tmpj_2t4njx.py", line 79 return len(lst) IndentationError: unexpected indent
s881904823
p02573
u153047519
1599174563
Python
Python (3.8.2)
py
Runtime Error
26
9024
621
class union: def __init__(self, box): self.r = [] for i in range(box): self.r.append(-1) def root(self, x): if self.r[x] < 0: return x return self.r[x] = root(self.r[x]) def add(self, a, b): a = root(a) b = root(b) if a == b: return False if self.r[a] > self...
File "/tmp/tmpnx4x2w9f/tmpskt1bv7r.py", line 10 return self.r[x] = root(self.r[x]) ^ SyntaxError: invalid syntax
s808006103
p02573
u794173881
1599171119
Python
PyPy3 (7.3.0)
py
Runtime Error
466
111160
1338
class UnionFind: """素集合を木構造として管理する""" def __init__(self, n): self.parent = [-1] * n self.cnt = n def root(self, x): """要素xの根を求める""" if self.parent[x] < 0: return x else: self.parent[x] = self.root(self.parent[x]) return self.parent...
Traceback (most recent call last): File "/tmp/tmpsdkjqn3y/tmpxpy2us30.py", line 40, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s835006898
p02573
u181412342
1599165164
Python
PyPy3 (7.3.0)
py
Runtime Error
231
116708
2059
import sys, io, os, re from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right from pprint import pprint from math import sin, cos, pi, radians, sqrt, floor, ceil from copy import copy, deepcopy from collections import deque, defaultdict from fractions import gcd from functools import re...
Traceback (most recent call last): File "/tmp/tmpned_id37/tmpg2w435lf.py", line 7, in <module> from fractions import gcd ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
s607654863
p02573
u181412342
1599163791
Python
PyPy3 (7.3.0)
py
Runtime Error
1110
586140
1776
import sys, io, os, re from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right from pprint import pprint from math import sin, cos, pi, radians, sqrt, floor, ceil from copy import copy, deepcopy from collections import deque, defaultdict from fractions import gcd from functools import re...
Traceback (most recent call last): File "/tmp/tmpeyhsb9ah/tmp7vv0dy44.py", line 7, in <module> from fractions import gcd ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
s605996421
p02573
u181412342
1599163751
Python
PyPy3 (7.3.0)
py
Runtime Error
1156
582284
1777
import sys, io, os, re from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right from pprint import pprint from math import sin, cos, pi, radians, sqrt, floor, ceil from copy import copy, deepcopy from collections import deque, defaultdict from fractions import gcd from functools import re...
Traceback (most recent call last): File "/tmp/tmpvd8yqlrl/tmp7cgp9k5s.py", line 7, in <module> from fractions import gcd ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
s787092222
p02573
u181412342
1599163714
Python
PyPy3 (7.3.0)
py
Runtime Error
1103
583396
1776
import sys, io, os, re from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right from pprint import pprint from math import sin, cos, pi, radians, sqrt, floor, ceil from copy import copy, deepcopy from collections import deque, defaultdict from fractions import gcd from functools import re...
Traceback (most recent call last): File "/tmp/tmphlo89wd8/tmpjnlfqens.py", line 7, in <module> from fractions import gcd ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
s362816999
p02573
u181412342
1599163668
Python
PyPy3 (7.3.0)
py
Runtime Error
1154
584792
1777
import sys, io, os, re from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right from pprint import pprint from math import sin, cos, pi, radians, sqrt, floor, ceil from copy import copy, deepcopy from collections import deque, defaultdict from fractions import gcd from functools import re...
Traceback (most recent call last): File "/tmp/tmpen9bix32/tmpi6nhtb3b.py", line 7, in <module> from fractions import gcd ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
s998413133
p02573
u181412342
1599163620
Python
PyPy3 (7.3.0)
py
Runtime Error
121
74312
1776
import sys, io, os, re from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right from pprint import pprint from math import sin, cos, pi, radians, sqrt, floor, ceil from copy import copy, deepcopy from collections import deque, defaultdict from fractions import gcd from functools import re...
File "/tmp/tmpmm689yh5/tmpjc6hcuwt.py", line 12 sys.setrecursionlimit(5000) IndentationError: unexpected indent
s064288607
p02573
u181412342
1599163595
Python
PyPy3 (7.3.0)
py
Runtime Error
90
74724
1778
import sys, io, os, re from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right from pprint import pprint from math import sin, cos, pi, radians, sqrt, floor, ceil from copy import copy, deepcopy from collections import deque, defaultdict from fractions import gcd from functools import re...
File "/tmp/tmpfdijiy32/tmpm9kf84ih.py", line 12 sys.setrecursionlimit(10000) IndentationError: unexpected indent
s432096533
p02573
u181412342
1599162864
Python
PyPy3 (7.3.0)
py
Runtime Error
474
191804
1820
import sys, io, os, re from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right from pprint import pprint from math import sin, cos, pi, radians, sqrt, floor, ceil from copy import copy, deepcopy from collections import deque, defaultdict from fractions import gcd from functools import re...
Traceback (most recent call last): File "/tmp/tmph34wtjon/tmp6e9yqelh.py", line 7, in <module> from fractions import gcd ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
s134117002
p02573
u181412342
1599162753
Python
PyPy3 (7.3.0)
py
Runtime Error
443
193396
1803
import sys, io, os, re from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right from pprint import pprint from math import sin, cos, pi, radians, sqrt, floor, ceil from copy import copy, deepcopy from collections import deque, defaultdict from fractions import gcd from functools import re...
Traceback (most recent call last): File "/tmp/tmpigcrn699/tmpm7cj3fvv.py", line 7, in <module> from fractions import gcd ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
s721800892
p02573
u169165784
1599157839
Python
Python (3.8.2)
py
Runtime Error
1308
63452
1006
import numpy class UnionFind: def __init__(self, N): self.N = N # the parent of all node is itself # self.parent = list(range(N)) self.parent = [-1] * N def root(self, i): if self.parent[i] < 0: return i r = self.root(self.parent[i]) self.p...
Traceback (most recent call last): File "/tmp/tmpt16tnjm3/tmpvjqv9mb7.py", line 38, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s748879033
p02573
u169165784
1599157572
Python
Python (3.8.2)
py
Runtime Error
1377
63456
1056
import numpy class UnionFind: def __init__(self, N): self.N = N # the parent of all node is itself # self.parent = list(range(N)) self.parent = [-1] * N def root(self, i): if self.parent[i] < 0: return i else: r = self.root(self.parent[i...
Traceback (most recent call last): File "/tmp/tmpaltytnii/tmp7a4dbt66.py", line 38, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s192592542
p02573
u238084414
1599147310
Python
Python (3.8.2)
py
Runtime Error
537
16504
393
def root(x): if F[x] < 0: return x else: F[x] = root(F[x]) return F[x] def unite(x, y): rx = root(x) ry = root(y) if rx == ry: return if rx > ry: x, y = y, x F[x] += F[y] F[y] = x N, M = map(int, input().split()) F = [-1] * N for m in range(M): a, b = map(int, input().split()) ...
Traceback (most recent call last): File "/tmp/tmpv9wdntbt/tmpt_jljd8v.py", line 18, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s348713542
p02573
u845573105
1599146871
Python
Python (3.8.2)
py
Runtime Error
745
19800
476
N, M = map(int, input().split()) r = [i for i in range(N+1)] n = [0 for i in range(N+1)] buf = [] def root(x): if x==r[x]: return x else: r[x] = root(r[x]) return r[x] def unite(x, y): rx = root(x) ry = root(y) if rx != ry: r[ry] = rx for _ in range(M): a, b = map(int, input().split()) ...
Traceback (most recent call last): File "/tmp/tmpxqq35ym5/tmp4odvmi4s.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s354998282
p02573
u196455939
1599144615
Python
PyPy3 (7.3.0)
py
Runtime Error
2071
370876
672
#D - Friends N,M = map(int,input().split()) par = [i for i in range(N+1)] rank = [1] * (N + 1) def find(x): if par[x] == x: return x else: par[x] = find(par[x]) #経路圧縮 return par[x] def size(x): return par.count(find(x)) def unite(x,y): x = find(x) y = find(y) if x == y...
Traceback (most recent call last): File "/tmp/tmpozzxl93z/tmpm87gaq_q.py", line 2, in <module> N,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s064276018
p02573
u525571359
1599142840
Python
PyPy3 (7.3.0)
py
Runtime Error
2213
231544
1479
import sys from io import StringIO import unittest def resolve(): N, M = map(int, input().split()) l = [] for _ in range(M): i,j = map(int, input().split()) gi = find_group(l,i) if not gi: gi = {i} l.append(gi) gj = find_group(l, j) if not gj:...
Traceback (most recent call last): File "/tmp/tmps19p0g6y/tmp4rj70kif.py", line 79, in <module> resolve() File "/tmp/tmps19p0g6y/tmp4rj70kif.py", line 6, in resolve N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s769425019
p02573
u433697974
1599142453
Python
Python (3.8.2)
py
Runtime Error
460
29840
556
import sys N, M = map(int, input().split()) if M == 0: print(1) sys.exit() check = [0]*N friendlist = [] tmp = 1 for i in range(M): a, b = map(lambda x: int(x)-1, input().split()) if check[a] + check[b] == 0: check[a] = tmp check[b] = tmp friendlist.append(set([a,b])) tmp += 1 elif check[a...
Traceback (most recent call last): File "/tmp/tmpof5yqtyj/tmpnaj310xi.py", line 3, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s077447492
p02573
u196455939
1599141940
Python
Python (3.8.2)
py
Runtime Error
2365
149472
648
#D - Friends N,M = map(int,input().split()) par = [i for i in range(N+1)] def find(x): if par[x] == x: return x else: par[x] = find(par[x]) #経路圧縮 return par[x] def size(x): return par.count(find(x)) def unite(x,y): x = find(x) y = find(y) if x == y: return 0 ...
Traceback (most recent call last): File "/tmp/tmp5od_jpww/tmpa_lei3vh.py", line 2, in <module> N,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s634082649
p02573
u433697974
1599141855
Python
Python (3.8.2)
py
Runtime Error
483
29452
506
N, M = map(int, input().split()) check = [0]*N friendlist = [] tmp = 1 for i in range(M): a, b = map(lambda x: int(x)-1, input().split()) if check[a] + check[b] == 0: check[a] = tmp check[b] = tmp friendlist.append(set([a,b])) tmp += 1 elif check[a] == 0: friendlist[check[b]-1].add(a) chec...
Traceback (most recent call last): File "/tmp/tmpresnsv0d/tmpucqmaiwh.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s485679429
p02573
u377834804
1599119949
Python
Python (3.8.2)
py
Runtime Error
822
13852
679
class UnionFind: def __init__(self, N): self.r = [-1]*(N+1) def root(self, x): if self.r[x] < 0: return x else: self.r[x] = self.root(self.r[x]) return self.r[x] def unite(self, x, y): x = self.root(x) y = self.root(y) if x == y: return False else: s...
Traceback (most recent call last): File "/tmp/tmpjjd7_lrd/tmpdy283dgs.py", line 29, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s903721526
p02573
u474202990
1599119288
Python
PyPy3 (7.3.0)
py
Runtime Error
95
80876
1154
class unionfind(): def __init__(self,n): #親番号<0なら根 #根の場合、数値の絶対値が要素数 self.par=[-1 for i in range(n)] def root(self,x): par=self.par if par[x]<0: return x else: self.root = self.root(par[x]) return self.root ...
Traceback (most recent call last): File "/tmp/tmpmvnifhqh/tmppidh_75r.py", line 41, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s295165338
p02573
u377834804
1599119201
Python
Python (3.8.2)
py
Runtime Error
835
14252
675
class UnionFind: def __init__(self, N): self.r = [-1]*N def root(self, x): if self.r[x] < 0: return x else: self.r[x] = self.root(self.r[x]) return self.r[x] def unite(self, x, y): x = self.root(x) y = self.root(y) if x == y: return False else: self....
Traceback (most recent call last): File "/tmp/tmphofksh19/tmpm6ih4ltk.py", line 29, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s568251205
p02573
u474202990
1599116391
Python
PyPy3 (7.3.0)
py
Runtime Error
2207
87592
895
class unionfind(): def __init__(self,n): self.par=[i for i in range(n)] def root(self,x): #自分自身の番号==parの番号なら根 par=self.par if par[x]==x: return x else: self.root = self.root(par[x]) return self.root def unite(self...
Traceback (most recent call last): File "/tmp/tmp7kjk4k3v/tmpqpxqfqg8.py", line 31, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s978391515
p02573
u148472503
1599091277
Python
Python (3.8.2)
py
Runtime Error
2206
53472
702
from collections import defaultdict n,m = map(int, input().strip().split(" ")) adjList = defaultdict(list) for i in range(m): a,b = map(int, input().strip().split(" ")) a-=1 b-=1 if b not in adjList[a]: adjList[a].append(b) if a not in adjList[b]: adjList[b].append(a) ...
Traceback (most recent call last): File "/tmp/tmpmbaderwm/tmpf43kdhmz.py", line 3, in <module> n,m = map(int, input().strip().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s498320556
p02573
u148472503
1599090984
Python
Python (3.8.2)
py
Runtime Error
2206
53404
663
from collections import defaultdict n,m = map(int, input().strip().split(" ")) adjList = defaultdict(list) for i in range(m): a,b = map(int, input().strip().split(" ")) a-=1 b-=1 if b not in adjList[a]: adjList[a].append(b) if a not in adjList[b]: adjList[b].append(a) ...
Traceback (most recent call last): File "/tmp/tmpz9qk9m3c/tmpwozkjkh8.py", line 3, in <module> n,m = map(int, input().strip().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s137264024
p02573
u531219227
1599090208
Python
Python (3.8.2)
py
Runtime Error
483
603832
470
import sys sys.setrecursionlimit(10**9) N,M = map(int,input().split()) root = [i for i in range(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) ...
Traceback (most recent call last): File "/tmp/tmp6ujisa6w/tmp38dcjgrv.py", line 3, in <module> N,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s493668344
p02573
u279439669
1599088255
Python
Python (3.8.2)
py
Runtime Error
2207
57860
799
class UnionFind(): par = [] sizes = [] def __init__(self, N): self.par = [i for i in range(N)] self.sizes = [1 for _ in range(N)] def root(self, x: int)-> int: if (self.par[x] == x): return x return self.root(self.par[x]) def unite(self, x: int, y: int): rootX = self.root(x) r...
Traceback (most recent call last): File "/tmp/tmpst1qj4lz/tmphz9b_kfd.py", line 33, in <module> nm = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s194961133
p02573
u279439669
1599087500
Python
Python (3.8.2)
py
Runtime Error
2206
61276
771
class UnionFind(): par = [] sizes = [] def __init__(self, N): self.par = [i for i in range(N)] self.sizes = [1 for _ in range(N)] def root(self, x: int)-> int: if (self.par[x] == x): return x return self.root(self.par[x]) def unite(self, x: int, y: int): rootX = self.root(x) r...
Traceback (most recent call last): File "/tmp/tmpavwtrqxh/tmpsk3djfkd.py", line 32, in <module> nm = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s140714698
p02573
u148472503
1599087140
Python
Python (3.8.2)
py
Runtime Error
2207
53248
653
from collections import defaultdict n,m = map(int, input().strip().split(" ")) adjList = defaultdict(list) for i in range(m): a,b = map(int, input().strip().split(" ")) if b not in adjList[a]: adjList[a].append(b) if a not in adjList[b]: adjList[b].append(a) mca = 0 visited...
Traceback (most recent call last): File "/tmp/tmpir0zgy8z/tmpztsl5b_5.py", line 3, in <module> n,m = map(int, input().strip().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s049378590
p02573
u970267139
1599083893
Python
Python (3.8.2)
py
Runtime Error
2206
17580
815
class UnionFind(): def __init__(self, n): self.par = [-1]*n def root(self, x): if self.par[x] < 0: return x return self.root(self.par[x]) def unite(self, x, y): if x > y: x, y = y, x rx = self.root(x) ry = self.root(y) if rx !...
Traceback (most recent call last): File "/tmp/tmpxfizrvmt/tmprfmubcyh.py", line 30, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s514857902
p02573
u970267139
1599083850
Python
Python (3.8.2)
py
Runtime Error
28
10600
808
class UnionFind(): def __init__(self, n): self.par = [-1]*n def root(self, x): if self.par[x] < 0: return x return self.root(self.par[x]) def unite(self, x, y): if x > y: x, y = y, x rx = self.root(x) ry = self.root(y) if rx !...
Traceback (most recent call last): File "/tmp/tmpjlknf171/tmpwsgs0r9f.py", line 30, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s882458646
p02573
u970267139
1599083496
Python
Python (3.8.2)
py
Runtime Error
2207
54096
831
n, m = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(m)] class UnionFind: def __init__(self, n): self.par = [-1]*n def root(self, x): if self.par[x] < 0: return x return self.root(self.par[x]) def unite(self, x, y): if x > y: ...
Traceback (most recent call last): File "/tmp/tmpjamummn_/tmpd9mfsh3p.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s752365142
p02573
u957098479
1599081883
Python
Python (3.8.2)
py
Runtime Error
2206
11268
681
import collections #=input() #=int(input()) n,m=map(int,input().split()) #=list(map(int,input().split())) #=[list(map(int,input().split())) for _ in range()] def rep(l, x, y): for i in range(n + 1): if l[i] == x: l[i] = y l = [0] * (n + 1) for i in range(1, m + 1): a,b = map(int,input().s...
Traceback (most recent call last): File "/tmp/tmp4imvqo7f/tmp__sdy0yc.py", line 4, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s963085823
p02573
u707316131
1599076425
Python
PyPy3 (7.3.0)
py
Runtime Error
2210
172268
1274
def dfs(visited, graph, node): if node not in visited: visited.append(node) for neighbour in graph[node]: dfs(visited, graph, neighbour) def insert_adj_list(graph,f,t): if (t not in graph[f]): graph[f].append(t) if (f not in graph[t]): graph[t].append(f) def i...
Traceback (most recent call last): File "/tmp/tmpyn1dwiq2/tmp474by48g.py", line 34, in <module> n,m=[int(i) for i in input().split(" ")] ^^^^^^^ EOFError: EOF when reading a line
s276249206
p02573
u707316131
1599076250
Python
PyPy3 (7.3.0)
py
Runtime Error
2208
172336
1269
def dfs(visited, graph, node): if node not in visited: visited[node]=1 for neighbour in graph[node]: dfs(visited, graph, neighbour) def insert_adj_list(graph,f,t): if (t not in graph[f]): graph[f].append(t) if (f not in graph[t]): graph[t].append(f) def init_d...
Traceback (most recent call last): File "/tmp/tmpvsro5zbz/tmp5e7oodfn.py", line 34, in <module> n,m=[int(i) for i in input().split(" ")] ^^^^^^^ EOFError: EOF when reading a line
s920252866
p02573
u940780117
1599073622
Python
Python (3.8.2)
py
Runtime Error
672
32040
506
N,Q=map(int,input().split()) par=[i for i in range(N+1)] def find(x): if par[x] ==x: return x else: par[x] = find(par[x]) return par[x] def same(x,y): return find(x) == find(y) def unite(x,y): x = find(x) y = find(y) if x == y: return 0 par[x]=y for i in range...
Traceback (most recent call last): File "/tmp/tmpnr7b5mjh/tmpd8gu13y7.py", line 1, in <module> N,Q=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s080019123
p02573
u182509599
1599070870
Python
Python (3.8.2)
py
Runtime Error
2207
51072
965
""" https://atcoder.jp/contests/abc177/tasks/abc177_d """ def solve(n, m, a): grp = [] for f in a: if len(grp) == 0: grp.append(set(f)) else: u = False for gi, g in enumerate(grp): if f[0] in g or f[1] in g: grp[gi] = ...
Traceback (most recent call last): File "/tmp/tmp737q7k4p/tmpx0pe8mm0.py", line 44, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s295527461
p02573
u699636103
1599055384
Python
PyPy3 (7.3.0)
py
Runtime Error
476
81872
809
class disjoint: def __init__(self, x: int): self.a = [-1] * x def root(self, x: int): if self.a[x] < 0: return x self.a[x] = self.root(self.a[x]) return self.a[x] def unite(self, x: int, y: int): x, y = self.root(x), self.root(y) if x == y: ...
Traceback (most recent call last): File "/tmp/tmpkiz4nx0t/tmpqbtg8obe.py", line 26, in <module> n, m = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s559866393
p02573
u614381513
1599050417
Python
Python (3.8.2)
py
Runtime Error
992
58688
461
from statistics import mode n, m = map(int, input().split()) rels = [i for i in range(n + 1)] inf = [] count = [0] * n for i in range(m): rel = list(map(int, input().split())) rel = sorted(rel) inf.append(rel) inf = sorted(inf) for rel in inf: a = rel[0] - 1 b = rel[1] - 1 rels[b] = rels[a]...
Traceback (most recent call last): File "/tmp/tmptk055zy5/tmpawjatxzh.py", line 3, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s888759678
p02573
u614381513
1599038536
Python
Python (3.8.2)
py
Runtime Error
76
33692
335
from statistics import mode n, m = map(int, input().split()) rels = [i for i in range(n)] #count = [0] * n #print(count) for i in range(m): rel = list(map(int, input().split())) rel = sorted(rel) a = rel[0] - 1 b = rel[1] - 1 rels[b] = rels[a] count[a] = count[a] + 1 #print(count) pr...
Traceback (most recent call last): File "/tmp/tmp5r2dw6r8/tmpc5i1syc8.py", line 3, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s355906088
p02573
u698902360
1599037924
Python
Python (3.8.2)
py
Runtime Error
812
50948
775
import sys from collections import defaultdict import collections class UnionFindPathCompression(): def __init__(self, n): self.parents = list(range(n)) def find(self, x): if self.parents[x] == x: return x else: self.parents[x] = self.find(self.parents[x]) ...
Traceback (most recent call last): File "/tmp/tmp409lx7bm/tmpf4z_edg1.py", line 26, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s872950683
p02573
u970267139
1598999018
Python
Python (3.8.2)
py
Runtime Error
2207
68664
844
n, m = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(m)] class UnionFind: par = [] def __init__(self, n): for i in range(n): self.par.append(i) def root(self, x): if self.par[x] == x: return x return self.root(self.par[x]) ...
Traceback (most recent call last): File "/tmp/tmpp0h_jsqp/tmppwew5e3c.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s092059873
p02573
u699636103
1598994641
Python
PyPy3 (7.3.0)
py
Runtime Error
499
86872
821
class disjoint: def __init__(self, x: int): self.a = [-1 for i in range(x)] def root(self, x: int): if self.a[x] < 0: return x self.a[x] = self.root(self.a[x]) return self.a[x] def unite(self, x: int, y: int): x, y = self.root(x), self.root(y) if...
Traceback (most recent call last): File "/tmp/tmplwo5q45m/tmp8pj7g006.py", line 25, in <module> n, m = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s121363456
p02573
u124864167
1598992938
Python
Python (3.8.2)
py
Runtime Error
1705
309624
108
from networkx import*;_,*n=map(str.split,open(0));print(max(map(len,[*connected_components(Graph(n))]),1,1))
Traceback (most recent call last): File "/tmp/tmp68so4co3/tmp9083v_p6.py", line 1, in <module> from networkx import*;_,*n=map(str.split,open(0));print(max(map(len,[*connected_components(Graph(n))]),1,1)) ^^^^ ValueError: not enough values to unpack (expected at least 1, got 0)
s525044624
p02573
u699636103
1598992094
Python
PyPy3 (7.3.0)
py
Runtime Error
490
114540
457
n, m = [int(i) for i in input().split()] graph = [[] for i in range(n)] for _ in range(m): x, y = [int(i) for i in input().split()] x -= 1 y -= 1 graph[x].append(y) graph[y].append(x) vis = [False] * n def dfs(x): vis[x] = False count = 1 for i in graph[x]: if not vis[i]: ...
Traceback (most recent call last): File "/tmp/tmpnbn7nbjn/tmp9ufzzbj1.py", line 1, in <module> n, m = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s572200549
p02573
u699636103
1598990656
Python
Python (3.8.2)
py
Runtime Error
714
44664
492
n, m = [int(i) for i in input().split()] graph = [[] for i in range(n)] for _ in range(m): x, y = [int(i) for i in input().split()] x -= 1 y -= 1 graph[x].append(y) graph[y].append(x) vis = [False] * n def dfs(x: int): count = 1 for i in graph[x]: if not vis[i]: vis[i...
Traceback (most recent call last): File "/tmp/tmpyc__1xre/tmpej03h1_5.py", line 1, in <module> n, m = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s151741154
p02573
u699636103
1598990459
Python
Python (3.8.2)
py
Runtime Error
741
44512
494
n, m = [int(i) for i in input().split()] graph = [[] for i in range(n)] for _ in range(m): x, y = [int(i) for i in input().split()] x -= 1 y -= 1 graph[x].append(y) graph[y].append(x) vis = [False] * n def dfs(x): count = 1 for i in graph[x]: if vis[i] == False: vis[i]...
Traceback (most recent call last): File "/tmp/tmpktr5ah8y/tmps5td7z7j.py", line 1, in <module> n, m = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s638141378
p02573
u570155187
1598984913
Python
Python (3.8.2)
py
Runtime Error
2207
62936
767
from collections import Counter n,m = map(int,input().split()) ab = list(list(map(int,input().split())) for _ in range(m)) a,b = [list(i) for i in zip(*ab)] group = [-1]*(n+1) group_name = 0 for i in range(m): if group[a[i]] == -1 and group[b[i]] == -1: group[a[i]] = group_name group[b[i]] = group_name ...
Traceback (most recent call last): File "/tmp/tmpkj1q8fc5/tmps49tcfm1.py", line 3, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s684511378
p02573
u200887663
1598984089
Python
Python (3.8.2)
py
Runtime Error
1101
104988
1055
#n = int(input()) import random n, m = map(int, input().split()) #al = list(map(int, input().split())) #l = [list(map(int,input().split())) for i in range(n)] adjl = [[] for _ in range(n+1)] NIL = -1 appear = {} isalone = {} for i in range(m): a, b = map(int, input().split()) if appear.get((a, b), False) or app...
Traceback (most recent call last): File "/tmp/tmpj0vrqjo7/tmpdumm0820.py", line 3, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line