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
s000132706
p02573
u238786149
1600592265
Python
PyPy3 (7.3.0)
py
Runtime Error
83
68760
227
import networkx as nx G = nx.Graph() n, m = map(int, input().split()) for i in range(m): a, b = map(int, input().split()) G.add_edge(a, b) largest_cc = max(nx.connected_components(G), key=len) print(len(largest_cc))
Traceback (most recent call last): File "/tmp/tmp8sv4lcjl/tmpkn555f_h.py", line 5, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s680024884
p02573
u941645670
1600462568
Python
Python (3.8.2)
py
Runtime Error
880
78420
411
n,m = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(m)] a, b = [list(i) for i in zip(*ab)] ans = [i for i in range(1,n+1,1)] #now = [1]*n now_num = 1 link = [[] * 1 for i in range(n)] for i in ab: link[i[0]-1].append(i[1]) link[i[1]-1].append(i[0]) a = max(len(link[i[0]-1]...
Traceback (most recent call last): File "/tmp/tmppw7kv2ol/tmp4fifxia0.py", line 1, in <module> n,m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s504140099
p02573
u342563578
1600456466
Python
PyPy3 (7.3.0)
py
Runtime Error
90
74784
1212
par = [] for i in range(n): par.append(-1) #初期親 rank = [1 for i in range(n)] #初期ランク cut = [] def find(n): #親検索andランク短縮 global cut if par[n] < 0: for i in range(len(cut)): par[cut[i]] = n cut = [] return n else: cut.append(n) find(par[n]) retur...
Traceback (most recent call last): File "/tmp/tmprarvy67p/tmpoh_1b18y.py", line 2, in <module> for i in range(n): ^ NameError: name 'n' is not defined
s317119677
p02573
u342563578
1600456369
Python
PyPy3 (7.3.0)
py
Runtime Error
91
74792
1182
par = [] for i in range(n): par.append(-1) #初期親 rank = [1 for i in range(n)] #初期ランク cut = [] def find(n): #親検索andランク短縮 global cut if par[n] < 0: for i in range(len(cut)): par[cut[i]] = n cut = [] return n else: cut.append(n) find(par[n]) retur...
Traceback (most recent call last): File "/tmp/tmpqebhfl16/tmp_vgj0vz8.py", line 2, in <module> for i in range(n): ^ NameError: name 'n' is not defined
s129233289
p02573
u342563578
1600448163
Python
PyPy3 (7.3.0)
py
Runtime Error
118
101192
378
n,m = map(int,input().split()) par = [] for i in range(n): par.append(i) #初期親 rank = [1 for i in range(n)] #初期ランク cut = [] for i in range(m): a,b = map(int,input().split()) a -= 1 b -= 1 unite(a,b) for i in range(n): shorten(i) import collections c = collections.Counter(par) ans = 0 for i in ra...
Traceback (most recent call last): File "/tmp/tmpwouhsmyr/tmpvl7c5uxx.py", line 1, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s746492813
p02573
u322171361
1600445100
Python
Python (3.8.2)
py
Runtime Error
2207
53056
429
n, m = map(int, input().split()) g = [[] for _ in range(n+1)] for i in range(m): a, b = map(int, input().split()) g[a].append(b) g[b].append(a) seen = [False]*(n+1) seen[0] = True def dfs(root): depth=0 seen[root] = True for i in g[root]: if seen[i]: continue depth ...
Traceback (most recent call last): File "/tmp/tmp69h6rg35/tmpx00__w8x.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s630884415
p02573
u322171361
1600443228
Python
Python (3.8.2)
py
Runtime Error
2206
44744
427
n, m = map(int, input().split()) g = [[] for _ in range(n+1)] for i in range(m): a, b = map(int, input().split()) g[a].append(b) g[b].append(a) seen = [False]*(n+1) seen[0] = True def dfs(root): depth=0 seen[root] = True for i in g[root]: if seen[i]: continue depth ...
Traceback (most recent call last): File "/tmp/tmp7zz5jkpg/tmpkwot7ulq.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s508402274
p02573
u729972685
1600410202
Python
PyPy3 (7.3.0)
py
Runtime Error
385
211068
574
from sys import stdin from itertools import accumulate input = stdin.readline from collections import Counter N, M = map(int, input().split()) friends = [tuple(map(int, inp.strip().split())) for inp in stdin.read().splitlines()] father = list(range(N)) def getfather(x): if father[x] != x: father[x] = ge...
Traceback (most recent call last): File "/tmp/tmpqjti4vj_/tmpdz2yrxoy.py", line 7, in <module> N, M = map(int, input().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s487141809
p02573
u729972685
1600409322
Python
PyPy3 (7.3.0)
py
Runtime Error
398
209680
547
from sys import stdin from itertools import accumulate input = stdin.readline from collections import Counter N,M = map(int,input().split()) friends = [tuple(map(int,inp.split())) for inp in stdin.read().splitlines()] father = list(range(N)) def getfather(x): if father[x] != x: father[x] = getfather(father[...
Traceback (most recent call last): File "/tmp/tmpmtmfchze/tmplw_p8_c9.py", line 5, in <module> N,M = map(int,input().split()) ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s803224251
p02573
u630211216
1600237745
Python
Python (3.8.2)
py
Runtime Error
693
19108
417
N,M=map(int,input().split()) parent=[i for i in range(N)] def find(x,par): y=par[x] while y!=par[y]: y=find(y,par) par[x]=y return par[x] def unite(a,b,par): x=find(a,par) y=find(b,par) if x!=y: par[x]=y for _ in range(M): A,B=map(int,input().split()) unite(A-1,B-1,...
Traceback (most recent call last): File "/tmp/tmpb9apv7fe/tmpbny5bq4y.py", line 1, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s710900851
p02573
u243535639
1600209632
Python
PyPy3 (7.3.0)
py
Runtime Error
744
167252
755
from typing import Counter def main(): N, M = map(int, input().split()) friend = [set([]) for _ in range(N)] for _ in range(M): A, B = map(int, input().split()) friend[A-1].add(B-1) friend[B-1].add(A-1) ans = 0 global visited visited = [0] * N for n in range(N): ...
Traceback (most recent call last): File "/tmp/tmpebf9ip6b/tmpdk8cb54u.py", line 38, in <module> main() File "/tmp/tmpebf9ip6b/tmpdk8cb54u.py", line 5, in main N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s870873946
p02573
u510582860
1600200223
Python
Python (3.8.2)
py
Runtime Error
2206
26460
290
N,M=map(int,input().split()) V=[] for _ in range(M): s=set(map(int,input().split())) f=True for v in V: l=len(s&v) if l>0: f=False if l==1: v.update(s) break if f: V.append(s) print(max(map(len,V)))
Traceback (most recent call last): File "/tmp/tmp0cmygn3e/tmptocxv8uz.py", line 1, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s585022718
p02573
u510582860
1600199555
Python
Python (3.8.2)
py
Runtime Error
2206
26404
254
N,M=map(int,input().split()) V=[] for _ in range(M): s=set(map(int,input().split())) f=True for v in V: if len(s&v)>0: v.update(s) f=False break if f: V.append(s) print(max(map(len,V)))
Traceback (most recent call last): File "/tmp/tmpeci2y19s/tmpcuuvrrwi.py", line 1, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s350444653
p02573
u510582860
1600197356
Python
Python (3.8.2)
py
Runtime Error
2206
9780
339
N,M=map(int,input().split()) V=[] for _ in range(M): a,b=map(int,input().split()) flg=True for v in V: if (a in v) or (b in v): if a not in v: v.append(a) if b not in v: v.append(b) flg=False if flg: V.append([a,b]) prin...
Traceback (most recent call last): File "/tmp/tmpxook1qsa/tmp6ycpemvp.py", line 1, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s085821373
p02573
u798818115
1600189392
Python
Python (3.8.2)
py
Runtime Error
903
47980
500
# coding: utf-8 # Your code here! N,M=map(int,input().split()) visited=[0]*N frnds=[[] for i in range(N)] for _ in range(M): a,b=map(int,input().split()) frnds[a-1].append(b-1) frnds[b-1].append(a-1) for i in range(N): frnds[i]=list(set(frnds[i])) def saiki(num): value=1 visited[num]=1 f...
Traceback (most recent call last): File "/tmp/tmpbuyzojqe/tmpb8e36174.py", line 3, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s407862967
p02573
u974402118
1600115189
Python
Python (3.8.2)
py
Runtime Error
2207
68424
351
N,M = (int(x) for x in input().split()) m = [] for i in range(M): a,b = (int(x)-1 for x in input().split()) m.append({a,b}) m_merge = [m.pop(0)] while m: for j in range(len(m_merge)): if m_merge[j]&m[0]: m_merge[j] = m_merge[j]|m.pop(0) break else: m_merge.append(m.pop(0)) m_size = [len(x) for x...
Traceback (most recent call last): File "/tmp/tmpvh7bv1_q/tmpmik8s3b5.py", line 1, in <module> N,M = (int(x) for x in input().split()) ^^^^^^^ EOFError: EOF when reading a line
s535678180
p02573
u974402118
1600115081
Python
Python (3.8.2)
py
Runtime Error
2208
68648
352
N,M = (int(x) for x in input().split()) m = [] for i in range(M): a,b = (int(x)-1 for x in input().split()) m.append({a,b}) m_merge = [m.pop(0)] while m: for j in range(len(m_merge)): if m_merge[j]&m[0]: m_merge[j] = m_merge[j]|m.pop(0) break else: m_merge.append(m.pop(0)) m_size = [size(x) for ...
Traceback (most recent call last): File "/tmp/tmpuczzacci/tmpgaf4puuw.py", line 1, in <module> N,M = (int(x) for x in input().split()) ^^^^^^^ EOFError: EOF when reading a line
s922251463
p02573
u528470578
1600095434
Python
Python (3.8.2)
py
Runtime Error
764
45056
444
N, M = map(int, input().split()) ki = [[] for _ in range(N)] for _ in range(M): a, b = map(int, input().split()) ki[a-1].append(b-1) ki[b-1].append(a-1) tf = [False for _ in range(N)] # DFS def dfs(v): global eda tf[v] = True eda += 1 for nv in set(ki[v]): if not tf[nv]: ...
Traceback (most recent call last): File "/tmp/tmp3eitg00d/tmp5zcjjwap.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s845334829
p02573
u458412487
1600088468
Python
Python (3.8.2)
py
Runtime Error
2207
45652
465
N=list(map(int,input().split())) n=N[0] m=N[1] A = [] for i in range(m): array = list(map(int,input().split())) array.sort() A.append(array) def get_unique_list(seq): seen = [] return [x for x in seq if x not in seen and not seen.append(x)] X=get_unique_list(A) import collections t = map(tuple,X) count...
Traceback (most recent call last): File "/tmp/tmpw4xhgi1k/tmpn6qgr_ge.py", line 1, in <module> N=list(map(int,input().split())) ^^^^^^^ EOFError: EOF when reading a line
s539835414
p02573
u254221913
1600085162
Python
PyPy3 (7.3.0)
py
Runtime Error
2337
3509436
307
n, m = map(int, input().split()) friend = [[0]*n for i in range(n)] s = [0] * n for i in range(m): a, b = map(int, input().split()) if friend[a-1][b-1] != 1 and friend[b-1][a-1] != 1: friend[a-1][b-1] = 1 friend[b-1][a-1] = 1 s[a-1] += 1 s[b-1] += 1 print(max(s) + 1)
Traceback (most recent call last): File "/tmp/tmpc0y10ecr/tmpl_yccb7y.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s374818022
p02573
u254221913
1600084984
Python
PyPy3 (7.3.0)
py
Runtime Error
2331
3510596
238
n, m = map(int, input().split()) friend = [[0]*n for i in range(n)] s = 0 for i in range(m): a, b = map(int, input().split()) friend[a-1][b-1] = 1 friend[b-1][a-1] = 1 for i in range(n): s = max(s, sum(friend[i])) print(s)
Traceback (most recent call last): File "/tmp/tmpyvu6j3bn/tmpldus_b3u.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s683658898
p02573
u112007848
1600078025
Python
Python (3.8.2)
py
Runtime Error
900
188700
580
import sys import resource def root(x): if par[x] == x: return x par[x] = root(par[x]) return par[x] def union(x, y): rx = root(x) ry = root(y) if rx != ry: par[rx] = ry return 0 sys.setrecursionlimit(10 ** 5 * 2) n, m=map(int, input().split(" ")) par = list(range(n + 1)) for i in range(m): a...
Traceback (most recent call last): File "/tmp/tmpbcp7qy6c/tmpcyfdumwm.py", line 18, in <module> n, m=map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s774673334
p02573
u112007848
1600077521
Python
Python (3.8.2)
py
Runtime Error
496
19072
521
def root(x): if par[x] == x: return x par[x] = root(par[1]) return par[x] def union(x, y): rx = root(x) ry = root(y) if rx != ry: par[rx] = ry return 0 n, m=map(int, input().split(" ")) par = list(range(n + 1)) for i in range(m): a, b = map(int, input().split(" ")) union(a, b) #print(par...
Traceback (most recent call last): File "/tmp/tmp1xmt0pvz/tmpijhg4ucu.py", line 14, in <module> n, m=map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s632932676
p02573
u112007848
1600075963
Python
Python (3.8.2)
py
Runtime Error
713
24080
533
def root(x): if par[x] == x: return x par[x] = root(par[x]) return par[x] def union(x, y): rx = root(x) ry = root(y) if rx != ry: par[rx] = ry return 0 n, m=map(int, input().split(" ")) par = list(range(n + 1)) + [0 for i in range(200000)] for i in range(m): a, b = map(int, input().split("...
Traceback (most recent call last): File "/tmp/tmpsbfu90h_/tmp477ugv2g.py", line 14, in <module> n, m=map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s914972478
p02573
u112007848
1600075921
Python
Python (3.8.2)
py
Runtime Error
684
18944
527
def root(x): if par[x] == x: return x par[x] = root(par[x]) return par[x] def union(x, y): rx = root(x) ry = root(y) if rx != ry: par[rx] = ry return 0 n, m=map(int, input().split(" ")) par = list(range(n + 1)) + [0 for i in range(100)] for i in range(m): a, b = map(int, input().split(" ")...
Traceback (most recent call last): File "/tmp/tmp4c90r_52/tmp04weue60.py", line 14, in <module> n, m=map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s610253463
p02573
u112007848
1600073114
Python
Python (3.8.2)
py
Runtime Error
684
18904
467
def root(x): if par[x] == x: return x par[x] = root(par[x]) return par[x] def union(x, y): rx = root(x) ry = root(y) if rx != ry: par[rx] = ry return 0 n, m=map(int, input().split(" ")) par = list(range(n + 1)) for i in range(m): a, b = map(int, input().split(" ")) union(a, b) #print(par...
Traceback (most recent call last): File "/tmp/tmp76bneac8/tmpdmsv1sw9.py", line 14, in <module> n, m=map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s218253999
p02573
u112007848
1600070774
Python
Python (3.8.2)
py
Runtime Error
396
45336
532
def root(i): if par[i] == i: return i par[i] = root(par[i]) return par[i] def union(x, y): rx = root(x) ry = root(y) if rx != ry: par[ry] = rx def same(x, y): return par[x] == par[y] n,m = map(int, input().split(" ")) p = [0] + list(map(int, input().split(" "))) a = [(list(map(int, input().spli...
Traceback (most recent call last): File "/tmp/tmp51pyrm2t/tmp04rcpvgm.py", line 16, in <module> n,m = map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s087318715
p02573
u112007848
1600070751
Python
Python (3.8.2)
py
Runtime Error
399
45420
528
def root(i): if par[i] == i: return i par[i] = root(par[i]) return par[i] def union(x, y): rx = root(x) ry = root(y) if rx != ry: par[ry] = rx def same(x, y): return par[x] == par[y] n,m = map(int, input().split(" ")) p = [0] + list(map(int, input().split(" "))) a = [(list(map(int, input().spli...
Traceback (most recent call last): File "/tmp/tmpe_dy80u6/tmpll2l7byn.py", line 16, in <module> n,m = map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s704293034
p02573
u112007848
1600070698
Python
Python (3.8.2)
py
Runtime Error
397
45180
532
def root(i): if par[i] == i: return i par[i] = root(par[i]) return par[i] def union(x, y): rx = root(x) ry = root(y) if rx != ry: par[ry] = rx def same(x, y): return par[x] == par[y] n,m = map(int, input().split(" ")) p = [0] + list(map(int, input().split(" "))) a = [(list(map(int, input().spli...
Traceback (most recent call last): File "/tmp/tmpwt4__3wh/tmptu606o_e.py", line 16, in <module> n,m = map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s091102342
p02573
u112007848
1600063411
Python
Python (3.8.2)
py
Runtime Error
585
19084
462
def root(x): if par[x] == x: return x par[x] = root(par[x]) return 1 def union(x, y): rx = root(x) ry = root(y) if rx != ry: par[rx] = ry return 0 n, m=map(int, input().split(" ")) par = list(range(n + 1)) for i in range(m): a, b = map(int, input().split(" ")) union(a, b) #print(par) max...
Traceback (most recent call last): File "/tmp/tmpvt8j6gfs/tmpyia998vo.py", line 14, in <module> n, m=map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s969310334
p02573
u112007848
1600062425
Python
Python (3.8.2)
py
Runtime Error
664
19028
467
def root(x): if par[x] == x: return x par[x] = root(par[x]) return par[x] def union(x, y): rx = root(x) ry = root(y) if rx != ry: par[rx] = ry return 0 n, m=map(int, input().split(" ")) par = list(range(n + 1)) for i in range(m): a, b = map(int, input().split(" ")) union(a, b) #print(par...
Traceback (most recent call last): File "/tmp/tmp8_w9ohnk/tmp2h62hzir.py", line 14, in <module> n, m=map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s679594511
p02573
u248670337
1600057043
Python
Python (3.8.2)
py
Runtime Error
1598
299664
105
from networkx import * print(max(*map(len,connected_components(Graph([*map(str.split,open(0))][1:]))),1))
Traceback (most recent call last): File "/tmp/tmpaawfhbcm/tmpa9vut56_.py", line 2, in <module> print(max(*map(len,connected_components(Graph([*map(str.split,open(0))][1:]))),1)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'int' object is not iterable
s326020154
p02573
u248670337
1600056805
Python
Python (3.8.2)
py
Runtime Error
1629
299920
103
from networkx import * print(max(*map(len,connected_components(Graph([*map(str.split,open(0))][1:])))))
Traceback (most recent call last): File "/tmp/tmp3d7b6w0o/tmpgkm3dn3a.py", line 2, in <module> print(max(*map(len,connected_components(Graph([*map(str.split,open(0))][1:]))))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: max expected at least 1 argument, got 0
s676302927
p02573
u248670337
1600056256
Python
Python (3.8.2)
py
Runtime Error
1635
299864
103
from networkx import * print(max(*map(len,connected_components(Graph([*map(str.split,open(0))][1:])))))
Traceback (most recent call last): File "/tmp/tmpnk6amycu/tmpzviug156.py", line 2, in <module> print(max(*map(len,connected_components(Graph([*map(str.split,open(0))][1:]))))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: max expected at least 1 argument, got 0
s381482904
p02573
u248670337
1600056152
Python
Python (3.8.2)
py
Runtime Error
352
70096
97
from networkx import * print(max(*map(len,connected_components(Graph([*map(str,open(0))][1:])))))
Traceback (most recent call last): File "/tmp/tmpkpkryxvx/tmpm0b47b_2.py", line 2, in <module> print(max(*map(len,connected_components(Graph([*map(str,open(0))][1:]))))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: max expected at least 1 argument, got 0
s767289675
p02573
u248670337
1600056130
Python
Python (3.8.2)
py
Runtime Error
332
53160
95
from networkx import * print(max(*map(len,connected_components(Graph([input().split()][1:])))))
Traceback (most recent call last): File "/tmp/tmpazyge4u0/tmpdl4rxbt3.py", line 2, in <module> print(max(*map(len,connected_components(Graph([input().split()][1:]))))) ^^^^^^^ EOFError: EOF when reading a line
s260306507
p02573
u112007848
1600045811
Python
Python (3.8.2)
py
Runtime Error
676
19204
535
def root(x): if par[x] == x: return x par[x] = root(par[x]) return par[x] def union(x, y): rx = root(x) ry = root(y) if rx != ry: par[rx] = ry return 0 def same(x,y): rx = root(x) ry = root(y) return rx == ry n, m=map(int, input().split(" ")) par = list(range(n + 1)) for i in rang...
Traceback (most recent call last): File "/tmp/tmp1j_ai9ol/tmpzxqwh_i0.py", line 19, in <module> n, m=map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s832082129
p02573
u112007848
1600045135
Python
Python (3.8.2)
py
Runtime Error
669
19060
524
def root(x): if par[x] == x: return x par[x] = root(par[x]) return par[x] def union(x, y): rx = root(x) ry = root(y) if rx != ry: par[rx] = ry def same(x,y): rx = root(x) ry = root(y) return rx == ry n, m=map(int, input().split(" ")) par = list(range(n + 1)) for i in range(m): a, ...
Traceback (most recent call last): File "/tmp/tmpg1l6open/tmpxaoyr1oh.py", line 18, in <module> n, m=map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s776988618
p02573
u212831449
1600018632
Python
Python (3.8.2)
py
Runtime Error
626
45048
705
import collections n,m = map(int,input().split()) friend = [[] for i in range(n)] for i in range(m): a,b = map(int,input().split()) a -= 1 b -= 1 friend[a].append(b) friend[b].append(a) q = collections.deque() visited = [0 for i in range(n)] def dfs(): while q: s = q.pop() for...
Traceback (most recent call last): File "/tmp/tmpovczmzw3/tmp3ozwknpl.py", line 3, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s582411710
p02573
u832943002
1600017848
Python
Python (3.8.2)
py
Runtime Error
371
14480
461
import sys n, m = [int(a) for a in sys.stdin.readline().strip().split(" ")] uf = [-1] * n def root(x): if uf[x] < 0: return x uf[x] = root(uf[x]) return uf[x] def merge(x, y): if(root(x) != root(y)): uf[x] += uf[root(y)] uf[root(y)] = x for i in range(m): a, b = [int...
Traceback (most recent call last): File "/tmp/tmp_7xug96p/tmpnws49tdo.py", line 3, in <module> n, m = [int(a) for a in sys.stdin.readline().strip().split(" ")] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmp_7xug96p/tmpnws49tdo.py", line 3, in <listcomp> n, m = [int(a) fo...
s094695114
p02573
u360515075
1600008598
Python
PyPy3 (7.3.0)
py
Runtime Error
115
74164
432
import numpy as np from collections import defaultdict D = defaultdict(set) N, M = map(int,input().split()) L = np.zeros((N,N)) for _ in range(M): a, b = map(int,input().split()) D[a-1].add(b-1) D[b-1].add(a-1) Q = [] ans = 0 for i in range(N): vstd = set() Q.append(i) while Q: a = Q.pop() vstd.add...
Traceback (most recent call last): File "/tmp/tmpacdzzh_e/tmpw0swimbo.py", line 4, in <module> N, M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s879464924
p02573
u334792253
1600006224
Python
PyPy3 (7.3.0)
py
Runtime Error
387
195464
1007
import sys from collections import Counter input = sys.stdin.readline N, M = map(int, input().split()) A_B = [list(map(int, input().split())) for _ in range(M)] class UnionFind: def __init__(self, n): self.par = [i for i in range(N+1)] self.rank = [0]*(N+1) #検索 def find(self, x): ...
Traceback (most recent call last): File "/tmp/tmp737e2e2l/tmp1y6wh358.py", line 6, in <module> N, M = map(int, input().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s517794987
p02573
u112007848
1599996795
Python
Python (3.8.2)
py
Runtime Error
740
17576
658
def root(x): if par[x] == x: return x par[x] = root(par[x]) return par[x] def union(x, y): rx = root(x) ry = root(y) if rx != ry: par[rx] = ry def same(x,y): rx = root(x) ry = root(y) if rx == ry: print("Yes") else: print("No") n, m=map(int, input().split(" ")) par = list(...
Traceback (most recent call last): File "/tmp/tmpwq03vn61/tmpplojxghb.py", line 21, in <module> n, m=map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s754286644
p02573
u750783400
1599940290
Python
PyPy3 (7.3.0)
py
Runtime Error
672
220868
1418
#スタック、キューを使う from collections import deque N,M = map(int,input().split()) G = [ set() for row in range(N)] for i in range(M): A,B = map(int,input().split()) G[A-1].add(B-1) G[B-1].add(A-1) for i in range(N): G[i] = set(G[i]) #1グループに所属する最大数 ans = 0 #友達グループの数 count = 0 #各頂点の状態を色で表す WHITE:未訪問 GRAY:...
Traceback (most recent call last): File "/tmp/tmpsezjdem8/tmpt7r9nv20.py", line 5, in <module> N,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s838314083
p02573
u820685137
1599932120
Python
Python (3.8.2)
py
Runtime Error
602
17680
1296
"""D.""" import sys #def input() -> str: # noqa: A001 # """Input.""" # return sys.stdin.readline()[:-1] class UnionFindTree: """Union-find.""" def __init__(self, n: int) -> None: """Init.""" self.n = n self.parent = [-1] * n def find_root(self, x: int) -> int: ""...
Traceback (most recent call last): File "/tmp/tmp914vxuip/tmp7z44tyzk.py", line 48, in <module> n, m = map(int, input().split(' ')) ^^^^^^^ EOFError: EOF when reading a line
s968075873
p02573
u820685137
1599932046
Python
Python (3.8.2)
py
Runtime Error
817
17568
1283
"""D.""" import sys #def input() -> str: # noqa: A001 # """Input.""" # return sys.stdin.readline()[:-1] class UnionFindTree: """Union-find.""" def __init__(self, n: int) -> None: """Init.""" self.n = n self.parent = [-1] * n def find_root(self, x: int) -> int: ""...
Traceback (most recent call last): File "/tmp/tmpdp78ikgi/tmplqwbsu98.py", line 48, in <module> n, m = map(int, input().split(' ')) ^^^^^^^ EOFError: EOF when reading a line
s172694354
p02573
u820685137
1599931978
Python
Python (3.8.2)
py
Runtime Error
662
18684
1305
"""D.""" import sys from typing import List def input() -> str: # noqa: A001 """Input.""" return sys.stdin.readline()[:-1] class UnionFindTree: """Union-find.""" def __init__(self, n: int) -> None: """Init.""" self.n = n self.parent = [-1] * n def find_root(self, x: i...
Traceback (most recent call last): File "/tmp/tmpdb7i2g6l/tmpn2i94vjo.py", line 50, in <module> n, m = map(int, input().split(' ')) ^^^^ ValueError: invalid literal for int() with base 10: ''
s823827664
p02573
u820685137
1599923029
Python
Python (3.8.2)
py
Runtime Error
2206
37276
470
"""D.""" import sys from typing import List def input() -> str: # noqa: A001 """Input.""" return sys.stdin.readline()[:-1] n, m = map(int, input().split(' ')) groups: List[set] = [] for _ in range(m): a, b = map(int, input().split(' ')) for g in groups: if a in g: g.add(b) ...
Traceback (most recent call last): File "/tmp/tmpdfiuf1dm/tmp4hgger4j.py", line 12, in <module> n, m = map(int, input().split(' ')) ^^^^ ValueError: invalid literal for int() with base 10: ''
s361596743
p02573
u964904181
1599921887
Python
Python (3.8.2)
py
Runtime Error
524
52168
891
from copy import deepcopy n, m = map(int, input().split()) pairs = [0] * m for i in range(m): pairs[i] = list(map(int, input().split())) # N = 5 # pairs = [[1,2], [3,4], [5,1]] print(pairs) class UnionFind: def __init__(self, N): self.r = [-1] * N def root(self, x): if self.r[x] < 0: ...
Traceback (most recent call last): File "/tmp/tmpmo6dvxd4/tmp5m1g4svs.py", line 3, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s256525951
p02573
u310286716
1599895659
Python
Python (3.8.2)
py
Runtime Error
2211
176008
672
# -*- coding: utf-8 -*- n, m = map(int, input().split()) friend_list = [] friend_list2 = [] for i in range(m): a, b = map(int, input().split()) friend_list.append([a, b]) while friend_list: friend = friend_list.pop() if not friend_list2: friend_list2.append(friend) else: temp_list = friend_list2.copy...
Traceback (most recent call last): File "/tmp/tmpaco7t26o/tmpnbw7bob5.py", line 3, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s603735117
p02573
u310286716
1599894937
Python
Python (3.8.2)
py
Runtime Error
2210
203076
697
# -*- coding: utf-8 -*- n, m = map(int, input().split()) friend_list = [] friend_list2 = [] for i in range(m): a, b = map(int, input().split()) friend_list.append([a, b]) while friend_list: friend = friend_list.pop() if not friend_list2: friend_list2.append(friend) else: temp_list = friend_list2.copy...
Traceback (most recent call last): File "/tmp/tmpa8nlazzh/tmpzqnzsa3b.py", line 3, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s007150269
p02573
u776860223
1599886110
Python
PyPy3 (7.3.0)
py
Runtime Error
357
78624
787
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/tmpvpnsim0r/tmp9uumwl6p.py", line 30, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s017116482
p02573
u217131455
1599858650
Python
PyPy3 (7.3.0)
py
Runtime Error
356
78728
858
input_line = input().split() N = int(input_line[0]) M = int(input_line[1]) 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] ...
Traceback (most recent call last): File "/tmp/tmpl8rn_wj6/tmpo_ljl0c1.py", line 1, in <module> input_line = input().split() ^^^^^^^ EOFError: EOF when reading a line
s080579019
p02573
u217131455
1599853129
Python
PyPy3 (7.3.0)
py
Runtime Error
2208
78936
535
input_line = input().split() N = int(input_line[0]) M = int(input_line[1]) groups = [] for i in range(M): date = input().split() per1 = int(date[0]) per2 = int(date[1]) for j in range(len(groups)): if per1 in groups[j]: if not per2 in groups[j]: groups[j].append(per2) break ...
Traceback (most recent call last): File "/tmp/tmpn9slnae7/tmpp6_ca6tm.py", line 1, in <module> input_line = input().split() ^^^^^^^ EOFError: EOF when reading a line
s385610302
p02573
u526966088
1599850373
Python
Python (3.8.2)
py
Runtime Error
2206
66864
643
from collections import defaultdict N, M = map(int, input().split()) friend_info = [list(map(int, input().split())) for _ in range(M)] relation_dict = {} for person1, person2 in friend_info: add_flag = False for k, v in relation_dict.items(): if((person1 in v) or (person2 in v)): relation_...
Traceback (most recent call last): File "/tmp/tmpi38gqgn2/tmpijpwx8ag.py", line 3, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s368568516
p02573
u250734103
1599834894
Python
Python (3.8.2)
py
Runtime Error
572
26416
818
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): self.n = n self.parents = [-1] * (n+1) def find(self, x): if self.parents[x] < 0: return x else: ...
Traceback (most recent call last): File "/tmp/tmpm7fpk258/tmp3167wwjn.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s150625684
p02573
u729133443
1599795299
Python
Python (3.8.2)
py
Runtime Error
24
9040
668
import sys if sys.argv[-1] == 'ONLINE_JUDGE': import os, zlib, base64 open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c${TYO>cuR480@qAH2g<Sknro9VRsPM>-Bp2oMbdN;6g4ub)FGU-bp-_x$|gq%wU6t>WT*wMOY0gzARgSm<PTl{O42M-acZ>GgR)gKaC@nKT&GwVX(kN~!u8ucZ|Y8b(B=Z50NhloinL<u!3pzz_z0QZz6)r3^d(FK|_Vvacc{$MMog(mI...
Traceback (most recent call last): File "/tmp/tmprv14nid7/tmpq0j2nw0g.py", line 6, in <module> import solve ModuleNotFoundError: No module named 'solve'
s453290629
p02573
u644171993
1599778870
Python
PyPy3 (7.3.0)
py
Runtime Error
518
171756
546
#!/usr/bin/env python def dfs(node, edge, vis): if vis[node]: return 0 vis[node] = True count = 1 for b in edge[node]: if not vis[b]: count += dfs(b, edge, vis) return count n, m = [int(i) for i in input().split(' ')] edge = [[] for i in range(n)] for _ in range(m): ...
Traceback (most recent call last): File "/tmp/tmpy8ile3h2/tmp3ndza5sa.py", line 13, in <module> n, m = [int(i) for i in input().split(' ')] ^^^^^^^ EOFError: EOF when reading a line
s529303497
p02573
u375172966
1599771396
Python
PyPy3 (7.3.0)
py
Runtime Error
2243
1147304
376
n, m = map(int, input().split()) ab = [set(map(int, input().split())) for _ in range(m)] sets = [ab[0]] for a, b in ab[1:]: for i in range(len(sets)): if a in sets[i] or b in sets[i]: sets[i].add(a) sets[i].add(b) break else: sets.append({a, b,}) ans =...
Traceback (most recent call last): File "/tmp/tmpt0ny3pwo/tmpf96hyh0n.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s427801843
p02573
u375172966
1599771004
Python
Python (3.8.2)
py
Runtime Error
524
67636
149
n, m = map(int, input().split()) ab = [set(map(int, input().split())) for _ in range(m)] sets = [] sets.append(ab[0]) ans = 0 print(sets) print(ans)
Traceback (most recent call last): File "/tmp/tmpj05d9at6/tmpers6_iaf.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s273578015
p02573
u375172966
1599770936
Python
Python (3.8.2)
py
Runtime Error
546
67652
167
n, m = map(int, input().split()) ab = [set(map(int, input().split())) for _ in range(m)] sets = [ab[0]] ans = 0 for s in sets: ans = max(len(s), ans) print(ans)
Traceback (most recent call last): File "/tmp/tmplu3une8n/tmpmy0smjng.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s197543761
p02573
u375172966
1599770777
Python
Python (3.8.2)
py
Runtime Error
532
67652
114
n, m = map(int, input().split()) ab = [set(map(int, input().split())) for _ in range(m)] sets = [ab[0]] print(ans)
Traceback (most recent call last): File "/tmp/tmpv2n2i3cu/tmpfh484y_j.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s941730855
p02573
u375172966
1599770338
Python
Python (3.8.2)
py
Runtime Error
2218
361572
376
n, m = map(int, input().split()) ab = [set(map(int, input().split())) for _ in range(m)] sets = [ab[0]] for a, b in ab[1:]: for i in range(len(sets)): if a in sets[i] or b in sets[i]: sets[i].add(a) sets[i].add(b) break else: sets.append({a, b,}) ans =...
Traceback (most recent call last): File "/tmp/tmp9p5u_upq/tmpkg1yqikx.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s804048831
p02573
u576335153
1599745702
Python
Python (3.8.2)
py
Runtime Error
143
11656
1728
import typing class DSU: ''' Implement (union by size) + (path compression) Reference: Zvi Galil and Giuseppe F. Italiano, Data structures and algorithms for disjoint set union problems ''' def __init__(self, n: int = 0): self._n = n self.parent_or_size = [-1] * n def...
Traceback (most recent call last): File "/tmp/tmpu0beh37s/tmpgiwomobf.py", line 63, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s343714577
p02573
u124864167
1599736852
Python
Python (3.8.2)
py
Runtime Error
2206
15084
330
l=lambda:map(int, input().split()) n,m=l() p=[-1]*n p=[-1]*n def root(x): if p[x]<0:return x return (x:=root(p[x])) def union(x,y): x,y=root(x),root(y) if x==y: return p[x]+=p[y] p[y]=x def same(x,y): return root(x)==root(y) def size(x): return -p[r(x)] for _ in range(m): a,b=l() union(a-1,b-1) prin...
Traceback (most recent call last): File "/tmp/tmpb4uefprd/tmpuc8m21_p.py", line 2, in <module> n,m=l() ^^^ File "/tmp/tmpb4uefprd/tmpuc8m21_p.py", line 1, in <lambda> l=lambda:map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s463271967
p02573
u776860223
1599710963
Python
PyPy3 (7.3.0)
py
Runtime Error
457
151112
309
from collections import defaultdict friend_dict = defaultdict(list) N, M = map(int, input().split()) for m in range(M): x, y = map(int, input().split()) friend_dict[x].append(y) friend_dict[y].append(x) max_num_group = max([len(set(v)) for v in friend_dict.values()]) print(max_num_group + 1)
Traceback (most recent call last): File "/tmp/tmpu2aygeu8/tmpsi50oopt.py", line 5, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s528463264
p02573
u626337957
1599686471
Python
PyPy3 (7.3.0)
py
Runtime Error
104
74740
1363
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/tmp_w3py0ai/tmpj0e8idsz.py", line 48, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s174141953
p02573
u488401358
1599683633
Python
Python (3.8.2)
py
Runtime Error
29
9096
487
mycode = r''' # distutils: language=c++ # cython: language_level=3, boundscheck=False, wraparound=False, cdivision=True ctypedef long long LL from libc.stdio cimport scanf from libc.vector cimport vector ctypedef vector[LL] vec cdef: LL N,M vec A scanf("%lld %lld",N,M) ''' import sys import os if sys.argv[-1...
Traceback (most recent call last): File "/tmp/tmpx8nt79j0/tmpunf1rolc.py", line 23, in <module> import mycode ModuleNotFoundError: No module named 'mycode'
s053184784
p02573
u887833602
1599659237
Python
Python (3.8.2)
py
Runtime Error
2206
11396
588
def solve(N, M, fridens): parents = {} groups = {} for A, B in friends: parents[B] = A if A not in groups: if A not in parents: groups[A] = [A] else: continue groups[A].append(B) ans = len(max(groups.values(), key=len)) ...
Traceback (most recent call last): File "/tmp/tmp7irpjkle/tmpyngjd_fz.py", line 18, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s688875726
p02573
u697076802
1599657602
Python
Python (3.8.2)
py
Runtime Error
2207
39844
434
numbers = [int(i) for i in input().split()] N, M = numbers[0], numbers[1] AB = [] for m in range(M): numbers = [int(i) for i in input().split()] AB.append((numbers[0], numbers[1])) F = [] for A, B in AB: new = True for i, f in enumerate(F): if A in f or B in f: F[i] = f | {A} | {B...
Traceback (most recent call last): File "/tmp/tmpbsmax_mq/tmpi_c5mh1o.py", line 1, in <module> numbers = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s477415960
p02573
u235792800
1599629746
Python
Python (3.8.2)
py
Runtime Error
1264
107736
951
from sys import stdin import collections def ip(): return [int(i) for i in stdin.readline().split()] def sp(): return [str(i) for i in stdin.readline().split()] n,m = ip() # d = collections.defaultdict(list) d = {} seen = set() for i in range(m): x,y = ip() if (x,y) in seen or (y,x) in seen: continue ...
Traceback (most recent call last): File "/tmp/tmpko1diqi_/tmp006tldsw.py", line 6, in <module> n,m = ip() ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s502203025
p02573
u235792800
1599629377
Python
Python (3.8.2)
py
Runtime Error
1155
108080
796
from sys import stdin import collections def ip(): return [int(i) for i in stdin.readline().split()] def sp(): return [str(i) for i in stdin.readline().split()] n,m = ip() d = collections.defaultdict(list) seen = set() for i in range(m): x,y = ip() if (x,y) in seen or (y,x) in seen: continue d[x].a...
Traceback (most recent call last): File "/tmp/tmpfekmvv7k/tmpk9q5u9ke.py", line 6, in <module> n,m = ip() ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s221256978
p02573
u235792800
1599629248
Python
Python (3.8.2)
py
Runtime Error
1175
108052
770
from sys import stdin import collections def ip(): return [int(i) for i in stdin.readline().split()] def sp(): return [str(i) for i in stdin.readline().split()] n,m = ip() d = collections.defaultdict(list) seen = set() for i in range(m): x,y = ip() if (x,y) in seen or (y,x) in seen: continue d[x].a...
Traceback (most recent call last): File "/tmp/tmp80wdvhsj/tmpgog_qv1y.py", line 6, in <module> n,m = ip() ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s327987307
p02573
u235792800
1599628975
Python
Python (3.8.2)
py
Runtime Error
1166
108040
759
from sys import stdin import collections def ip(): return [int(i) for i in stdin.readline().split()] def sp(): return [str(i) for i in stdin.readline().split()] n,m = ip() d = collections.defaultdict(list) seen = set() for i in range(m): x,y = ip() if (x,y) in seen or (y,x) in seen: continue d[x].a...
Traceback (most recent call last): File "/tmp/tmpo2ci5vd_/tmpjvglx0w7.py", line 6, in <module> n,m = ip() ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s697106980
p02573
u792720861
1599597814
Python
Python (3.8.2)
py
Runtime Error
806
19104
529
class UnionFind: def __init__(self, n): self.p = list(range(n+1)) def find(self, x): if x == self.p[x]: return x self.p[x] = self.find(self.p[x]) return self.p[x] def unite(self, x, y): x, y = self.find(x), self.find(y) if x != y: self.p[x] = y n...
Traceback (most recent call last): File "/tmp/tmpv_cc6fe9/tmpu1rvic_4.py", line 13, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s831837796
p02573
u792720861
1599597435
Python
Python (3.8.2)
py
Runtime Error
800
19068
529
class UnionFind: def __init__(self, n): self.p = list(range(n+1)) def find(self, x): if x == self.p[x]: return x self.p[x] = self.find(self.p[x]) return self.p[x] def unite(self, x, y): x, y = self.find(x), self.find(y) if x != y: self.p[x] = y n...
Traceback (most recent call last): File "/tmp/tmpwbvl3ky3/tmpt1370efk.py", line 13, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s196182863
p02573
u947664173
1599519368
Python
Python (3.8.2)
py
Runtime Error
2208
116736
562
n,m=map(int,input().split()) ab = [map(int, input().split()) for _ in range(m)] a,b = [list(i) for i in zip(*ab)] indexlist=[-1]*n def findroot(x): while 1: if indexlist[x-1] < 0: return x else: x=indexlist[x-1] def merge(a,b): art=findroot(a) brt=find...
Traceback (most recent call last): File "/tmp/tmpjq9uqn6y/tmpv9e9e2cl.py", line 1, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s888425985
p02573
u947664173
1599519060
Python
PyPy3 (7.3.0)
py
Runtime Error
2209
152388
568
n,m=map(int,input().split()) ab = [map(int, input().split()) for _ in range(m)] a,b = [list(i) for i in zip(*ab)] indexlist=[-1]*n def findroot(x): while 1: if indexlist[x-1] < 0: return x else: x=indexlist[x-1] def merge(a,b): art=findroot(a) brt=fi...
Traceback (most recent call last): File "/tmp/tmpfrhvq9pf/tmpx7p4sxbh.py", line 1, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s998944061
p02573
u947664173
1599518510
Python
PyPy3 (7.3.0)
py
Runtime Error
2210
151988
624
n,m=map(int,input().split()) ab = [map(int, input().split()) for _ in range(m)] a,b = [list(i) for i in zip(*ab)] indexlist=[-1]*n def findroot(x): while 1: if indexlist[x-1] < 0: return x else: x=indexlist[x-1] def merge(a,b): art=findroot(a) brt=fi...
Traceback (most recent call last): File "/tmp/tmpw2i7tp_0/tmpbjs2ngzz.py", line 1, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s432156833
p02573
u358859892
1599495203
Python
Python (3.8.2)
py
Runtime Error
30
10420
632
class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def union(self, x, y): x = self.find(x) y = self.find(y) if x == y: return if self.parents[x] > self.parents[y]: x, y = y, x self.parents[x] += self.pa...
Traceback (most recent call last): File "/tmp/tmp10acvnrl/tmpa55nymuk.py", line 23, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s131294237
p02573
u434872492
1599493305
Python
PyPy3 (7.3.0)
py
Runtime Error
2209
140996
620
N,M = map(int,input().split()) G = [[] for i in range(N)] for i in range(M): a,b = map(int,input().split()) a-=1 b-=1 G[a].append(b) G[b].append(a) chk = [0 for i in range(N)] L = [0 for i in range(N)] def search(G,v,cnt,L,chk): chk[v]=1 L[v]=cnt for tmp in G[v]: if chk[tmp]!=0:...
Traceback (most recent call last): File "/tmp/tmpjxu_w6yr/tmp4uswzaei.py", line 1, in <module> N,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s074698073
p02573
u092650292
1599479486
Python
Python (3.8.2)
py
Runtime Error
699
19392
678
import collections n, m = map(int, input().split()) par = [i for i in range(n + 5)] # 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...
Traceback (most recent call last): File "/tmp/tmpqvs78cix/tmp6pjlt6cb.py", line 2, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s907306044
p02573
u021176439
1599479076
Python
Python (3.8.2)
py
Runtime Error
865
78160
552
n, m = map(int, input().split()) root = list(range(n + 1)) from collections import defaultdict d = defaultdict(set) def find(i): if i == root[i]: return i root[i] = find(root[i]) return root[i] def union(u, v): fu, fv = find(u), find(v) if fu == fv: d[min(fu, fv)].add(max(u, ...
Traceback (most recent call last): File "/tmp/tmplccezj2c/tmpuze9ocza.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s019934314
p02573
u021176439
1599478321
Python
Python (3.8.2)
py
Runtime Error
715
32564
484
n, m = map(int, input().split()) root = list(range(n + 1)) from collections import Counter d = Counter() def find(i): if i == root[i]: return i root[i] = find(root[i]) return root[i] def union(u, v): fu, fv = find(u), find(v) if fu == fv: return root[max(u, v)] = min(fu, ...
Traceback (most recent call last): File "/tmp/tmpqt22hfot/tmph_4rzsst.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s594786560
p02573
u198336369
1599475764
Python
Python (3.8.2)
py
Runtime Error
688
24796
697
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/tmpq4342djh/tmp3fmfi5lc.py", line 2, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s585056814
p02573
u198336369
1599475416
Python
Python (3.8.2)
py
Runtime Error
691
40156
684
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/tmp36uygrjm/tmp3b8mp2_b.py", line 2, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s039793385
p02573
u792720861
1599475403
Python
Python (3.8.2)
py
Runtime Error
784
18948
529
class UnionFind: def __init__(self, n): self.p = list(range(n+1)) def find(self, x): if x == self.p[x]: return x self.p[x] = self.find(self.p[x]) return self.p[x] def unite(self, x, y): x, y = self.find(x), self.find(y) if x != y: self.p[x] = y n...
Traceback (most recent call last): File "/tmp/tmpotr5sbxx/tmpyi354zx4.py", line 13, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s620180385
p02573
u794066762
1599442552
Python
PyPy3 (7.3.0)
py
Runtime Error
2209
126408
530
n, m = map(int, input().split(" ")) g = [[] for i in range(n)] vis = [False for j in range(n)] count = 0 def dfs(r): global count vis[r] = True count += 1 for v in g[r]: if not vis[v]: dfs(v) def solve(): global count mx = 0 for i in range(n): if i not in vis:...
Traceback (most recent call last): File "/tmp/tmpazsdeo11/tmpbgw7zsq8.py", line 1, in <module> n, m = map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s465245585
p02573
u092650292
1599439262
Python
Python (3.8.2)
py
Runtime Error
824
24900
1039
# 方針 union findで解く n, m = map(int, input().split()) # 入力の受け取り par = [i for i in range(1, n + 1)] # 親のリストを作成 # find関数を作成。自分の値とリスト番号を比べ、親ならば返し、子ならば親を探す # par[x-1]としているのは、例えばpar[0]=1になっているため def find(x): if par[x - 1] == x: return x else: par[x - 1] = find(par[x - 1]) return par[x - 1] ...
Traceback (most recent call last): File "/tmp/tmp9ewkhsdk/tmplngx6_f7.py", line 2, in <module> n, m = map(int, input().split()) # 入力の受け取り ^^^^^^^ EOFError: EOF when reading a line
s280813923
p02573
u092650292
1599439111
Python
Python (3.8.2)
py
Runtime Error
816
40268
1026
# 方針 union findで解く n, m = map(int, input().split()) # 入力の受け取り par = [i for i in range(1, n + 1)] # 親のリストを作成 # find関数を作成。自分の値とリスト番号を比べ、親ならば返し、子ならば親を探す # par[x-1]としているのは、例えばpar[0]=1になっているため def find(x): if par[x - 1] == x: return x else: par[x - 1] = find(par[x - 1]) return par[x - 1] ...
Traceback (most recent call last): File "/tmp/tmp5jkv7boe/tmpdw0kdipb.py", line 2, in <module> n, m = map(int, input().split()) # 入力の受け取り ^^^^^^^ EOFError: EOF when reading a line
s800387414
p02573
u092650292
1599439099
Python
Python (3.8.2)
py
Runtime Error
735
17140
1027
# 方針 union findで解く n, m = map(int, input().split()) # 入力の受け取り par = [i for i in range(1, n + 1)] # 親のリストを作成 # find関数を作成。自分の値とリスト番号を比べ、親ならば返し、子ならば親を探す # par[x-1]としているのは、例えばpar[0]=1になっているため def find(x): if par[x - 1] == x: return x else: par[x - 1] = find(par[x - 1]) return par[x - 1] ...
Traceback (most recent call last): File "/tmp/tmprnai7c_y/tmphrlyurid.py", line 2, in <module> n, m = map(int, input().split()) # 入力の受け取り ^^^^^^^ EOFError: EOF when reading a line
s200770965
p02573
u169042722
1599438822
Python
Python (3.8.2)
py
Runtime Error
2207
63296
773
N,M=[int(a) for a in input().split()] AB=list() for i in range(M): AB.append([int(a) for a in input().split()]) #print(N,M,AB) flists=list() for pair in AB: list0=-1 list1=-1 for j,flist in enumerate(flists): if pair[0] in flist: list0=j if pair[1] in flist: list...
Traceback (most recent call last): File "/tmp/tmp3wwhf5qg/tmp2vw5og2l.py", line 1, in <module> N,M=[int(a) for a in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s753894737
p02573
u198336369
1599437284
Python
Python (3.8.2)
py
Runtime Error
818
40316
1005
# 方針 union findで解く n, m = map(int, input().split()) # 入力の受け取り par = [i for i in range(1,n+1)] # 親のリストを作成 # find関数を作成。自分の値とリスト番号を比べ、親ならば返し、子ならば親を探す # par[x-1]としているのは、例えばpar[0]=1になっているため def find(x): if par[x-1] == x: return x else: par[x-1] = find(par[x-1]) return par[x-1] # union関数...
Traceback (most recent call last): File "/tmp/tmpx3k_ozq8/tmp846awefb.py", line 2, in <module> n, m = map(int, input().split()) # 入力の受け取り ^^^^^^^ EOFError: EOF when reading a line
s960957269
p02573
u198336369
1599436123
Python
Python (3.8.2)
py
Runtime Error
822
40112
469
n, m = map(int, input().split()) par = [i for i in range(1,n+1)] def find(x): if par[x-1] == x: return x else: par[x-1] = find(par[x-1]) return par[x-1] def union(x,y): x = find(x) y = find(y) if x == y: return 0 par[x-1] = y for j in range(m): a,b = map(int, ...
Traceback (most recent call last): File "/tmp/tmpp76cqot5/tmp9uf74on5.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s691369338
p02573
u185034753
1599427195
Python
Python (3.8.2)
py
Runtime Error
953
111156
805
from collections import defaultdict def main(): N, M = map(int, input().split()) g = defaultdict(set) for _ in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 g[a].add(b) g[b].add(a) from functools import lru_cache def dfs(u, visited: set): ...
Traceback (most recent call last): File "/tmp/tmp_pupay9w/tmpv3535vp9.py", line 38, in <module> main() File "/tmp/tmp_pupay9w/tmpv3535vp9.py", line 4, in main N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s177693952
p02573
u185034753
1599427144
Python
Python (3.8.2)
py
Runtime Error
967
111404
757
from collections import defaultdict def main(): N, M = map(int, input().split()) g = defaultdict(set) for _ in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 g[a].add(b) g[b].add(a) from functools import lru_cache def dfs(u, visited: set): ...
Traceback (most recent call last): File "/tmp/tmpcz3f3bh_/tmpl31yx5h7.py", line 36, in <module> main() File "/tmp/tmpcz3f3bh_/tmpl31yx5h7.py", line 4, in main N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s024194035
p02573
u061140245
1599426914
Python
Python (3.8.2)
py
Runtime Error
322
50156
609
import sys n, m = map(int, input().split()) info = [tuple(map(int, s.split())) for s in sys.stdin.readlines()] pars = [-1]*n def get_root(x): if pars[x] < 0: return x else: pars[x] = get_root(pars[x]) return pars[x] def combine(x, y): if x == y: return r_x = get_root(x...
Traceback (most recent call last): File "/tmp/tmpp1abw_xj/tmp0eozcndc.py", line 2, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s374973957
p02573
u061140245
1599426581
Python
Python (3.8.2)
py
Runtime Error
26
9096
573
n, m = map(int, input().split()) info = [tuple(map(int, s.split())) for s in sys.stdin.readlines()] pars = [-1]*n def get_root(x): if pars[x] < 0: return x else: return get_root(pars[x]) def combine(x, y): if x == y: return r_x = get_root(x) r_y = get_root(y) if r_x >...
Traceback (most recent call last): File "/tmp/tmpeeexopa9/tmpi0shllpt.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s867893312
p02573
u061140245
1599426389
Python
Python (3.8.2)
py
Runtime Error
729
17516
767
nm = input().split(" ") n = int(nm[0]) m = int(nm[1]) pars = [-1]*n def get_root(x): if pars[x] < 0: return x else: return get_root(pars[x]) def combine(x, y): if x == y: return r_x = get_root(x) r_y = get_root(y) if r_x > r_y: r_x, r_y = r_y, r_x if r_x !...
Traceback (most recent call last): File "/tmp/tmpt59izmsj/tmplia7pnrn.py", line 1, in <module> nm = input().split(" ") ^^^^^^^ EOFError: EOF when reading a line
s591316924
p02573
u061140245
1599425434
Python
Python (3.8.2)
py
Runtime Error
714
17536
736
nm = input().split(" ") n = int(nm[0]) m = int(nm[1]) pars = [-1]*n def get_root(x): if pars[x] < 0: return x else: return get_root(pars[x]) def combine(x, y): r_x = get_root(x) r_y = get_root(y) if r_x > r_y: r_x, r_y = r_y, r_x if r_x != r_y: pars[r_x] += pa...
Traceback (most recent call last): File "/tmp/tmp8g256mrf/tmp5vdf8n0j.py", line 1, in <module> nm = input().split(" ") ^^^^^^^ EOFError: EOF when reading a line