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
s884808634
p02536
u600195339
1601170335
Python
Python (3.8.2)
py
Runtime Error
273
31968
554
from collections import deque from collections import defaultdict n, m = map(int, input().split()) g = defaultdict(list) s = set(list(range(1, n+1))) ans = 0 for i in range(m): a, b = map(int, input().split()) g[a].append(b) while s: root = s.pop() q = deque() q.append(root) done = set() ...
Traceback (most recent call last): File "/tmp/tmplus1000a/tmp4swgcx83.py", line 4, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s350481945
p02536
u582803594
1601170335
Python
Python (3.8.2)
py
Runtime Error
144
9664
150
N,M = map(int,input().split()) L=[0]*N for i in range(M): A,B = map(int,input().split()) L[A] = 1 L[B] = 1 num = L.count(1) print(N-num)
Traceback (most recent call last): File "/tmp/tmpdxwn9pl3/tmp76x90moq.py", line 1, in <module> N,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s836277941
p02536
u327498205
1601170330
Python
Python (3.8.2)
py
Runtime Error
286
28080
2180
class AlgUnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n #各要素の親要素の番号を格納するリスト 要素が根(ルート)の場合は-(そのグループの要素数)を格納する def find(self, x): #要素xが属するグループの根を返す if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) ...
Traceback (most recent call last): File "/tmp/tmpeu1xgth5/tmpmvu04mzr.py", line 49, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s304475739
p02536
u993808866
1601170300
Python
PyPy3 (7.3.0)
py
Runtime Error
131
68608
522
N, M = map(int, input().split()) Pajew = [i for i in range(n)] import sys sys.setrecursionlimit(1000000) def find(x, Pajew): if Pajew[x] == x: return x else: a = find(Pajew[x], Pajew) Pajew[x] =a return a def unite(x, y): x = find(x, Pajew) y = find(y, Pajew) if x !...
Traceback (most recent call last): File "/tmp/tmpz2g2zqhi/tmpdi630wf9.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s442892527
p02536
u516483179
1601170276
Python
PyPy3 (7.3.0)
py
Runtime Error
310
77304
1355
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/tmpft4gk1l_/tmpsumr40fw.py", line 53, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s205773395
p02536
u600195339
1601170275
Python
Python (3.8.2)
py
Runtime Error
253
31812
556
from collections import deque from collections import defaultdict n, m = map(int, input().split()) g = defaultdict(list) s = set(list(range(1, n+1))) ans = 0 for i in range(m): a, b = map(int, input().split()) g[a].append(b) while s: root = s.pop() q = deque() q.append(root) done = set() ...
Traceback (most recent call last): File "/tmp/tmpksgycq_v/tmpitja9x51.py", line 4, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s813831872
p02536
u575354126
1601170260
Python
Python (3.8.2)
py
Runtime Error
185
27780
1220
import sys import math,bisect sys.setrecursionlimit(10 ** 5) from itertools import groupby,accumulate from heapq import heapify,heappop,heappush from collections import deque,Counter,defaultdict def I(): return int(sys.stdin.readline()) def neo(): return map(int, sys.stdin.readline().split()) def Neo(): return list(map...
Traceback (most recent call last): File "/tmp/tmpq2a5qjfv/tmptpxcedgg.py", line 34, in <module> N,M = neo() ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s022671959
p02536
u514441044
1601170256
Python
Python (3.8.2)
py
Runtime Error
298
31868
1239
from collections import Counter import string import math import sys def array_int(): return [int(i) for i in sys.stdin.readline().split()] def vary(number_of_variables): if number_of_variables==1: return int(sys.stdin.readline()) if number_of_variables>=2: return map(int,sys.stdin.readline(...
Traceback (most recent call last): File "/tmp/tmpa15khwqh/tmpmzm07g_p.py", line 26, in <module> n,m=vary(2) ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s715837926
p02536
u600195339
1601170240
Python
PyPy3 (7.3.0)
py
Runtime Error
265
87272
556
from collections import deque from collections import defaultdict n, m = map(int, input().split()) g = defaultdict(list) s = set(list(range(1, n+1))) ans = 0 for i in range(m): a, b = map(int, input().split()) g[a].append(b) while s: root = s.pop() q = deque() q.append(root) done = set() ...
Traceback (most recent call last): File "/tmp/tmpzvknxb79/tmp277g0z9s.py", line 4, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s718312783
p02536
u433375322
1601170231
Python
Python (3.8.2)
py
Runtime Error
189
12776
1177
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/tmp897n3i79/tmpur1xjme7.py", line 51, in <module> main() File "/tmp/tmp897n3i79/tmpur1xjme7.py", line 44, in main N, Q = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s257258101
p02536
u038408819
1601170167
Python
PyPy3 (7.3.0)
py
Runtime Error
321
90836
1340
n, m = map(int, input().split()) ab = [list(map(int, input().split())) for i in range(m)] 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(se...
Traceback (most recent call last): File "/tmp/tmppc2qj5me/tmpjh2m42qm.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s849571003
p02536
u658600714
1601170154
Python
PyPy3 (7.3.0)
py
Runtime Error
200
72300
177
import math n,m=map(int,input().split()) r=[0]*n for i in range (m): a,b=map(int,input().split()) r[a]+=1 r[b]+=1 ma = max(r) if ma>=n-1: print(0) else: print(n-1-ma)
Traceback (most recent call last): File "/tmp/tmpusk9q8y8/tmpzedkgvnk.py", line 2, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s645442354
p02536
u712284046
1601170137
Python
Python (3.8.2)
py
Runtime Error
323
22256
316
N, M = map(int, input().split()) City_list = [[i] for i in range(N)] ans = N - 1 - M for i in range(M): Ai, Bi = map(int, input().split()) if City_list[Ai] == City_list[Bi]: ans += 1 else: City_list[Ai] = City_list[Ai] + City_list[Bi] City_list[Bi] = City_list[Ai] print(ans)
Traceback (most recent call last): File "/tmp/tmpgax5xcp1/tmpq56mdvn5.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s531322647
p02536
u650939551
1601170129
Python
Python (3.8.2)
py
Runtime Error
382
27368
1656
# Python3 program to print DFS traversal # from a given given graph from collections import defaultdict viz = [0]*1005 # This class represents a directed graph using # adjacency list representation class Graph: # Constructor def __init__(self): # default dictionary to store graph self.graph...
Traceback (most recent call last): File "/tmp/tmp3z7rosgp/tmpgjqaq_2v.py", line 58, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s260479701
p02536
u772705651
1601170122
Python
Python (3.8.2)
py
Runtime Error
478
13052
438
N, M = map(int, input().split()) connect = {} no_connection = [n + 1 for n in range(N)] for _ in range(M): a, b = map(int, input().split()) no_connection.remove(a) no_connection.remove(b) for group_idx, group_set in connect.items(): if a in group_set: connect[group_idx] |= set([a, b]) br...
Traceback (most recent call last): File "/tmp/tmpwndgf01d/tmpx05datbv.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s524658712
p02536
u940652437
1601170109
Python
Python (3.8.2)
py
Runtime Error
29
9164
129
n,m=map(int,input().split()) t=[] for i in range(m): a=int(input()) t.append(a) l = len(set(t)) ans = n-l print(ans)
Traceback (most recent call last): File "/tmp/tmpmjt72lzp/tmp07s_vncn.py", line 1, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s790924363
p02536
u994147425
1601170088
Python
Python (3.8.2)
py
Runtime Error
209
12948
1369
# https://note.nkmk.me/python-union-find/ 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/tmpwkdzzmlf/tmpy6iif1ry.py", line 49, in <module> N,M = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s052843743
p02536
u694665829
1601170082
Python
PyPy3 (7.3.0)
py
Runtime Error
2256
1902664
263
n, m = map(int,input().split()) M = [[0 for _ in range(n)] for i in range(n)] for i in range(m): a, b = map(int,input().split()) M[a][b] = 1 cnt = 0 for i in range(n-1): if all(M[i][j] == 0 for j in range(1+i, n)): cnt += 1 print(cnt)
Traceback (most recent call last): File "/tmp/tmpc_yy5d0v/tmp58ywj0vn.py", line 1, in <module> n, m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s971137964
p02536
u941645670
1601170074
Python
Python (3.8.2)
py
Runtime Error
29
9008
254
from atcoder import dsu n,m = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(m)] ds = dsu.DSU(n) for i in ab: ds.merge(i[0]-1,i[1]-1) s = ds.groups() ans = 0 for i in s: if len(i)==1: ans+=1 print(ans)
Traceback (most recent call last): File "/tmp/tmpldjmfb8x/tmps1yaxlwc.py", line 1, in <module> from atcoder import dsu ModuleNotFoundError: No module named 'atcoder'
s202980593
p02536
u551310735
1601170074
Python
Python (3.8.2)
py
Runtime Error
2206
28312
975
# H4CKOM N = int(100100) g = [[] for i in range(N)] vis = [False for i in range(N)] vis2 = [False for i in range(N)] def add_edge(u, v): g[u].append(v) def dfs1(v): vis2[v] = True for to in g[v]: if not vis2[to]: dfs1(to) def dfs2(v): global ans vis[v] = True ans += 1 ...
Traceback (most recent call last): File "/tmp/tmpu1fcjtxq/tmpshi912x1.py", line 49, in <module> n, x = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s447834942
p02536
u501364195
1601170071
Python
Python (3.8.2)
py
Runtime Error
152
12156
570
N, M = map(int, input().split()) group = [] tf = [] for i in range(M): A, B = map(int, input().split()) if A and B not in tf: tf.append(A) tf.append(B) group.append([A,B]) else: if A not in tf: tf.append(A) for j in range(len(group)): if B in group[j]: group[i].append...
Traceback (most recent call last): File "/tmp/tmp895kw2qt/tmps2v5jmvz.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s361273390
p02536
u844872527
1601170066
Python
Python (3.8.2)
py
Runtime Error
226
27236
660
def MII(): return map(int, input().split()) def LII(): return list(map(int, input().split())) #bit = [i>>j&1 for j in range(n)] n,m=MII() connect_city=[LII() for _ in range(m)] groups=[[1]] for i in range(m): a,b=connect_city[i] flag=0 for j,group in enumerate(groups): if a in group: ...
Traceback (most recent call last): File "/tmp/tmpmygo99nn/tmpk0iz7pfr.py", line 7, in <module> n,m=MII() ^^^^^ File "/tmp/tmpmygo99nn/tmpk0iz7pfr.py", line 2, in MII def MII(): return map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s168802201
p02536
u766486294
1601170060
Python
Python (3.8.2)
py
Runtime Error
239
26228
2061
import types _atcoder_code = """ # Python port of AtCoder Library. __version__ = '0.0.1' """ atcoder = types.ModuleType('atcoder') exec(_atcoder_code, atcoder.__dict__) _atcoder_dsu_code = """ import typing class DSU: ''' Implement (union by size) + (path compression) Reference: Zvi Galil and Gius...
Traceback (most recent call last): File "/tmp/tmpv9snzmxd/tmpzcymfav4.py", line 85, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s174247129
p02536
u954153335
1601170031
Python
Python (3.8.2)
py
Runtime Error
35
12852
278
n,m=map(int,input().split()) data=list(range(n)) cnt=n-1 def find(x): if data[x]==x: return x else: find(data[x]) for i in range(m): a,b=map(int,input().split()) a=find(a-1) b=find(b-1) if a!=b: data[a]=b cnt-=1 print(cnt)
Traceback (most recent call last): File "/tmp/tmpbrrtdiaa/tmp_cixbjds.py", line 1, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s206081474
p02536
u501278784
1601169956
Python
Python (3.8.2)
py
Runtime Error
30
9412
463
import collections sys.setrecursionlimit(10**6) def dfs(visited,v,adj): visited[v]=True for i in adj[v]: if not visited[i]: dfs(visited,i,adj) adj=collections.defaultdict(list) n,m=map(int,input().split()) visited=[False]*n for i in range(m): u,v=map(int,input().split()) adj[u...
Traceback (most recent call last): File "/tmp/tmpuy6_gekq/tmpgxodtx47.py", line 2, in <module> sys.setrecursionlimit(10**6) ^^^ NameError: name 'sys' is not defined
s113400375
p02536
u536017058
1601169905
Python
PyPy3 (7.3.0)
py
Runtime Error
220
75464
922
class UnionFind: __slots__ = ["_data_size", "_roots"] def __init__(self, data_size: int) -> None: self._data_size = data_size self._roots = [-1] * data_size def __getitem__(self, x: int) -> int: while self._roots[x] >= 0: x = self._roots[x] return x def ...
Traceback (most recent call last): File "/tmp/tmpuaq3lpz1/tmp6vq_tn3e.py", line 30, in <module> N, Q = map(int, readline().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s116380386
p02536
u941645670
1601169903
Python
Python (3.8.2)
py
Runtime Error
220
27268
233
#c n,m = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(m)] ds = dsu.DSU(n) for i in ab: ds.merge(i[0]-1,i[1]-1) s = ds.groups() ans = 0 for i in s: if len(i)==1: ans+=1 print(ans)
Traceback (most recent call last): File "/tmp/tmpuxfjw5lq/tmp_ysk0gw0.py", line 2, in <module> n,m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s463628389
p02536
u519339498
1601169879
Python
Python (3.8.2)
py
Runtime Error
167
26232
2085
import types _atcoder_code = """ # Python port of AtCoder Library. __version__ = '0.0.1' """ atcoder = types.ModuleType('atcoder') exec(_atcoder_code, atcoder.__dict__) _atcoder_dsu_code = """ import typing class DSU: ''' Implement (union by size) + (path compression) Reference: Zvi Galil and Gius...
Traceback (most recent call last): File "/tmp/tmpvz1i72lf/tmp1fqnd8o1.py", line 93, in <module> main() File "/tmp/tmpvz1i72lf/tmp1fqnd8o1.py", line 85, in main N,M=map(int,pin().split()) ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s350250321
p02536
u473172054
1601169865
Python
Python (3.8.2)
py
Runtime Error
2206
18408
303
n, m = map(int, input().split()) par = [i for i in range(n)] for i in range(m): a, b = map(int, input().split()) if a > b: a, b = b, a cur = par[b] par[b] = par[a] while(cur in par): idx = par.index(cur) par[idx] = par[a] ans = len(set(par)) - 1 print(ans)
Traceback (most recent call last): File "/tmp/tmpiv0wzito/tmp60azmzxo.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s256867018
p02536
u420332509
1601169864
Python
Python (3.8.2)
py
Runtime Error
241
31152
422
from sys import setrecursionlimit setrecursionlimit(1000000) def l_in(type_): return list(map(type_, input().split())) def i_in(): return int(input()) def m_in(type_): return map(type_, input().split()) def r_in(n, type_): return [type_(input()) for _ in range(n)] n, m = m_in(int) ab = [list(m_in(int)) for _ in range(...
Traceback (most recent call last): File "/tmp/tmp15ijhp4f/tmp3fhhfm_z.py", line 8, in <module> n, m = m_in(int) ^^^^^^^^^ File "/tmp/tmp15ijhp4f/tmp3fhhfm_z.py", line 5, in m_in def m_in(type_): return map(type_, input().split()) ^^^^^^^ EOFError: EOF when r...
s776872046
p02536
u668190572
1601169862
Python
PyPy3 (7.3.0)
py
Runtime Error
152
69360
346
import sys,io,os I = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline I = input n,m = map(int, I().split()) p=[-1]*(n+1) s=[0]*(n+1) S=n-1 def t(a): while p[a] != -1: a = p[a] return a for _ in range(m): a,b=map(int, I().split()) a,b = t(a), t(b) if a != b: S -= 1 if s[a] > s[b]: a,b = b,a p[a] = b...
Traceback (most recent call last): File "/tmp/tmp5xxtcmca/tmpjj_cmzfr.py", line 5, in <module> n,m = map(int, I().split()) ^^^ EOFError: EOF when reading a line
s820726941
p02536
u544587633
1601169849
Python
PyPy3 (7.3.0)
py
Runtime Error
154
68568
1006
#!/usr/bin/env python3 import sys import networkx as nx def solve(N: int, M: int, A: "List[int]", B: "List[int]"): G = nx.Graph() for i in range(1, N+1): G.add_node(i) for i in range(M): G.add_edge(A[i], B[i]) if nx.is_connected(G): print(0) else: print(nx.number_...
Traceback (most recent call last): File "/tmp/tmp04n8_7a4/tmpdw2zkwdw.py", line 38, in <module> main() File "/tmp/tmp04n8_7a4/tmpdw2zkwdw.py", line 28, in main N = int(next(tokens)) # type: int ^^^^^^^^^^^^ StopIteration
s943329973
p02536
u461513098
1601169830
Python
Python (3.8.2)
py
Runtime Error
334
26980
536
def dfs(v): global visited visited[v] = True for nv in graph[v]: if nv in graph[v]: if not visited[nv]: dfs(nv) if __name__ == "__main__": N, M = map(int, input().split()) graph = [[] for _ in range(N)] visited = [False]*N for _ in range(M): A, B...
Traceback (most recent call last): File "/tmp/tmpogymq592/tmp3pmygr2l.py", line 11, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s202783717
p02536
u724549242
1601169820
Python
Python (3.8.2)
py
Runtime Error
214
12740
628
class UnionFind(): 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]) return self.parents[x] def union(self, x, y): x = self.find(x)...
Traceback (most recent call last): File "/tmp/tmp9ao_x59c/tmpj86udzso.py", line 21, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s561310003
p02536
u514401521
1601169807
Python
PyPy3 (7.3.0)
py
Runtime Error
288
80732
899
import sys sys.setrecursionlimit(10**5) class UnionFind: def __init__(self, n): self.d = [] for _ in range(n): self.d.append(-1) def find(self, x): if self.d[x] < 0: return x else: self.d[x] = self.find(self.d[x]) return self.d...
Traceback (most recent call last): File "/tmp/tmp0ojq_xc0/tmpqiqiglp0.py", line 33, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s054890300
p02536
u867826040
1601169798
Python
Python (3.8.2)
py
Runtime Error
2240
2859224
297
from scipy.sparse.csgraph import connected_components import numpy as np n,m = map(int,input().split()) g = np.zeros((n,n),dtype=np.int) for i in range(m): ai,bi = map(int,input().split()) g[ai-1][bi-1] = 1 g[bi-1][ai-1] = 1 r = connected_components(g,return_labels=False) print(r-1)
Traceback (most recent call last): File "/tmp/tmpp29f882q/tmp1u51atkj.py", line 5, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s965758137
p02536
u514390882
1601169786
Python
Python (3.8.2)
py
Runtime Error
337
26968
429
N, M = map(int, input().split()) e = [[] for _ in range(N)] for i in range(M): A, B = map(int, input().split()) A -= 1 B -= 1 e[A].append(B) e[B].append(A) # print(e) def dfs(n, k): seen[n] = k # print(seen) for i in e[n]: if seen[i] != -1: continue dfs(i, k) seen = [-1...
Traceback (most recent call last): File "/tmp/tmpgfqeowb5/tmpkc3criv4.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s179868099
p02536
u501278784
1601169782
Python
PyPy3 (7.3.0)
py
Runtime Error
712
115516
435
import collections def dfs(visited,v,adj): visited[v]=True for i in adj[v]: if not visited[i]: dfs(visited,i,adj) adj=collections.defaultdict(list) n,m=map(int,input().split()) visited=[False]*n for i in range(m): u,v=map(int,input().split()) adj[u-1].append(v-1) adj[v-...
Traceback (most recent call last): File "/tmp/tmpa4y77dmw/tmp8l0nfjro.py", line 9, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s977844901
p02536
u433375322
1601169779
Python
Python (3.8.2)
py
Runtime Error
218
14332
2057
class UnionFind(): """ unionfindtree のクラス グループを管理するデータ構造. 全てのメソッドの計算量が O(log(n)) よりも小さい init: 管理対象の個数 n を用いて初期化 find: ある要素 x の親がどの要素か返す union: ある要素 x と y が属しているグループを結合して1つのグループとする msize: ある要素 x が属するグループの大きさを返す """ def __init__(self, n): ...
Traceback (most recent call last): File "/tmp/tmpkgd511bd/tmps8t7efwi.py", line 66, in <module> main() File "/tmp/tmpkgd511bd/tmps8t7efwi.py", line 59, in main N, Q = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s071079976
p02536
u803865203
1601169759
Python
Python (3.8.2)
py
Runtime Error
202
12896
1303
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/tmpuhmyixbp/tmpnfmww_ur.py", line 48, in <module> N,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s454045053
p02536
u551310735
1601169753
Python
Python (3.8.2)
py
Runtime Error
2206
28144
970
# H4CKOM N = 100100 g = [[] for i in range(N)] vis = [False for i in range(N)] vis2 = [False for i in range(N)] def add_edge(u, v): g[u].append(v) def dfs1(v): vis2[v] = True for to in g[v]: if not vis2[to]: dfs1(to) def dfs2(v): global ans vis[v] = True ans += 1 fo...
Traceback (most recent call last): File "/tmp/tmptay3fhfv/tmpgybjp0si.py", line 49, in <module> n, x = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s546471764
p02536
u514401521
1601169727
Python
PyPy3 (7.3.0)
py
Runtime Error
281
80980
859
class UnionFind: def __init__(self, n): self.d = [] for _ in range(n): self.d.append(-1) def find(self, x): if self.d[x] < 0: return x else: self.d[x] = self.find(self.d[x]) return self.d[x] def union(self, x, y): ...
Traceback (most recent call last): File "/tmp/tmpkmwj4w_q/tmp7ofd0q4n.py", line 31, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s033998108
p02536
u682467216
1601169725
Python
Python (3.8.2)
py
Runtime Error
158
13636
2506
# coding=utf-8 from math import floor, ceil, sqrt, factorial, log, gcd, log10 from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain from bisect import bisect_left, bisect_right from collections import Counter, defaultdict, deque from heapq import heappop, heappush, ...
Traceback (most recent call last): File "/tmp/tmpmzvzq5ha/tmp4yl82ref.py", line 118, in <module> n, m = LI() ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s856750350
p02536
u766486294
1601169722
Python
Python (3.8.2)
py
Runtime Error
238
26376
2020
import types _atcoder_code = """ # Python port of AtCoder Library. __version__ = '0.0.1' """ atcoder = types.ModuleType('atcoder') exec(_atcoder_code, atcoder.__dict__) _atcoder_dsu_code = """ import typing class DSU: ''' Implement (union by size) + (path compression) Reference: Zvi Galil and Gius...
Traceback (most recent call last): File "/tmp/tmpuu9i0rns/tmpi33775bs.py", line 82, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s124500045
p02536
u551310735
1601169689
Python
Python (3.8.2)
py
Runtime Error
32
9800
969
# H4CKOM N = 10010 g = [[] for i in range(N)] vis = [False for i in range(N)] vis2 = [False for i in range(N)] def add_edge(u, v): g[u].append(v) def dfs1(v): vis2[v] = True for to in g[v]: if not vis2[to]: dfs1(to) def dfs2(v): global ans vis[v] = True ans += 1 for...
Traceback (most recent call last): File "/tmp/tmpp1zdeb9f/tmpbf_0thkk.py", line 49, in <module> n, x = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s676680777
p02536
u379894480
1601169655
Python
Python (3.8.2)
py
Runtime Error
29
9164
86
a,b,c,d=map(int,input().split()) if d<a or c>b: print("No") else: print("Yes")
Traceback (most recent call last): File "/tmp/tmpqaztmisj/tmpoe7s7m2m.py", line 1, in <module> a,b,c,d=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s027429041
p02536
u581634684
1601169648
Python
Python (3.8.2)
py
Runtime Error
243
27644
845
from sys import stdin, stdout from collections import defaultdict input = stdin.readline class Graph: def __init__(self,V): self.V = V self.adj = [[] for i in range(V)] def DFSUtil(self, temp, v, visited): visited[v] = True temp.append(v) for i in self.adj[v]: if visited[i] == False: temp = ...
Traceback (most recent call last): File "/tmp/tmpatvgxpbj/tmpwytp1m0n.py", line 30, in <module> n, m = map(int, input().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s378047619
p02536
u016843859
1601169642
Python
Python (3.8.2)
py
Runtime Error
2206
12048
398
N,M=map(int,input().split()) AB=list() memo=[False]*N def dps(G,i): memo[i]=True for j in range(len(G[i])): if (G[i][j]==1)&(memo[j]==False): dps(G,j) G=[[0]*N]*N count=0 for i in range(M): AB=list(map(int,input().split())) G[AB[0]-1][AB[1]-1]=1 G[AB[1]-1][AB[0]-1]=1 for i in ran...
Traceback (most recent call last): File "/tmp/tmpvnprbaoi/tmpajx2i16s.py", line 1, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s009001396
p02536
u318345739
1601169641
Python
PyPy3 (7.3.0)
py
Runtime Error
361
83784
987
class Tree: def __init__(self, N): self.N = N self.nodes = [ Node(i) for i in range(N) ] def get_root(self, node): if node.parent is None: return node root = self.get_root(node.parent) node.parent = root return root def merge(self, n1, n2): ...
Traceback (most recent call last): File "/tmp/tmpjs_v81qj/tmp71v6i1_k.py", line 46, in <module> main() File "/tmp/tmpjs_v81qj/tmp71v6i1_k.py", line 38, in main N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s781713040
p02536
u551310735
1601169636
Python
PyPy3 (7.3.0)
py
Runtime Error
117
68920
969
# H4CKOM N = 10010 g = [[] for i in range(N)] vis = [False for i in range(N)] vis2 = [False for i in range(N)] def add_edge(u, v): g[u].append(v) def dfs1(v): vis2[v] = True for to in g[v]: if not vis2[to]: dfs1(to) def dfs2(v): global ans vis[v] = True ans += 1 for...
Traceback (most recent call last): File "/tmp/tmpd6kmcota/tmpda9wchka.py", line 49, in <module> n, x = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s321458198
p02536
u235376569
1601169611
Python
Python (3.8.2)
py
Runtime Error
202
12896
1283
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/tmp8z41o1b2/tmpvx07bwt5.py", line 48, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s157744639
p02536
u514390882
1601169597
Python
PyPy3 (7.3.0)
py
Runtime Error
387
107612
440
N, M = map(int, input().split()) e = [[] for _ in range(N)] for i in range(M): A, B = map(int, input().split()) A -= 1 B -= 1 e[A].append(B) e[B].append(A) # print(e) def dfs(n, k): seen[n] = k # print(seen) for i in e[n]: if seen[i] != -1: continue dfs(i, k) return ...
Traceback (most recent call last): File "/tmp/tmp4iyfrf9s/tmp_xzla5mw.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s814870885
p02536
u922769680
1601169595
Python
Python (3.8.2)
py
Runtime Error
31
9012
198
N,M=map(int,input().split()) A=[list(map(int,input().split())) for i in range(M) import itertools import collections B=list(itertools.chain.from_iterable(A)) C=len(collections.Counter(B)) print(N-C)
File "/tmp/tmp9i8hduol/tmpt69xq7ax.py", line 2 A=[list(map(int,input().split())) for i in range(M) ^ SyntaxError: '[' was never closed
s017619760
p02536
u688839540
1601169584
Python
Python (3.8.2)
py
Runtime Error
69
20840
368
n,m = list(map(int,input().split())) res = [[x] for x in range(1,n+1)] for _ in range(m): i,j = list(map(int,input().split())) y,z = None,None for x in res: if i in x or j in x: if y == None: y = x if j in x: break else: z = x res.remove(y) res.rem...
Traceback (most recent call last): File "/tmp/tmpk67cq09m/tmp1tcg971n.py", line 1, in <module> n,m = list(map(int,input().split())) ^^^^^^^ EOFError: EOF when reading a line
s860036411
p02536
u581634684
1601169575
Python
PyPy3 (7.3.0)
py
Runtime Error
223
105712
845
from sys import stdin, stdout from collections import defaultdict input = stdin.readline class Graph: def __init__(self,V): self.V = V self.adj = [[] for i in range(V)] def DFSUtil(self, temp, v, visited): visited[v] = True temp.append(v) for i in self.adj[v]: if visited[i] == False: temp = ...
Traceback (most recent call last): File "/tmp/tmpnds3egyw/tmpt3i757m0.py", line 30, in <module> n, m = map(int, input().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s652507170
p02536
u435593586
1601169574
Python
Python (3.8.2)
py
Runtime Error
27
8976
133
n.m = map(int, input().split()) roads = [] for _ in range(m): a,b = map(int, input().split()) roads.append((a,b)) print(n-m-1)
Traceback (most recent call last): File "/tmp/tmpd58n475y/tmppmsypw6j.py", line 1, in <module> n.m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s269423577
p02536
u581634684
1601169553
Python
PyPy3 (7.3.0)
py
Runtime Error
206
105648
876
from sys import stdin, stdout from collections import defaultdict input = stdin.readline class Graph: def __init__(self,V): self.V = V self.adj = [[] for i in range(V)] def DFSUtil(self, temp, v, visited): visited[v] = True temp.append(v) for i in self.adj[v]: if visited[i] == False: temp = ...
Traceback (most recent call last): File "/tmp/tmp08spjyiy/tmpoet_v_yc.py", line 30, in <module> n, m = map(int, input().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s611656005
p02536
u650939551
1601169529
Python
PyPy3 (7.3.0)
py
Runtime Error
168
73872
1682
# Python3 program to count non-reachable # nodes from a given source using DFS. # Graph class represents a directed graph # using adjacency list representation class Graph: def __init__(self, V): self.V = V self.adj = [[] for i in range(V)] def addEdge(self, v, w): self.adj[v].append...
Traceback (most recent call last): File "/tmp/tmpxa6utr67/tmpvkmtcuhs.py", line 55, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s873687325
p02536
u111822487
1601169527
Python
PyPy3 (7.3.0)
py
Runtime Error
172
72004
239
l = input().split() N = int(l[0]) M = int(l[1]) arr = [0]*N retval = 0 for i in range(M): l = input().split() #A[i] = l[0] #B[i] = l[1] arr[int(l[0])] = 1 arr[int(l[1])] = 1 for i in range(N): retval += arr[i] print(N-retval)
Traceback (most recent call last): File "/tmp/tmpm54n0xa8/tmp1os18gea.py", line 1, in <module> l = input().split() ^^^^^^^ EOFError: EOF when reading a line
s571734509
p02536
u326552320
1601169509
Python
Python (3.8.2)
py
Runtime Error
268
27072
767
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: C # CreatedDate: 2020-09-26 20:52:24 +0900 # LastModified: 2020-09-26 21:18:10 +0900 # import os import sys # import numpy as np # import pandas as pd def BFS(cnt, color, path, u): color[u] = cnt for v in path[u]: if color[v] == -1: ...
Traceback (most recent call last): File "/tmp/tmpevkn6b4v/tmpfpleyrgk.py", line 40, in <module> main() File "/tmp/tmpevkn6b4v/tmpfpleyrgk.py", line 24, in main N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s721273846
p02536
u460009487
1601169507
Python
PyPy3 (7.3.0)
py
Runtime Error
272
86584
131
n, m = map(int, input().split()) a, b = [list(map(int,input().split())) for i in range(m)] c = a + b c = set(c) print(m-len(c)+1)
Traceback (most recent call last): File "/tmp/tmpxrzqohm4/tmp78ues81y.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s697189682
p02536
u137226361
1601169495
Python
Python (3.8.2)
py
Runtime Error
287
13964
415
n, m = map(int, input().split()) par = [i for i in range(n)] def find(x, par): if par[x] == x: return x else: return find(par[x], par) def unite(x, y): x = find(x, par) y = find(y, par) if x != y: par[x] = y for _ in range(m): a, b = map(int, input().split()) unite...
Traceback (most recent call last): File "/tmp/tmprex_e7eg/tmp5uhvi9x_.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s568700576
p02536
u138083942
1601169490
Python
PyPy3 (7.3.0)
py
Runtime Error
200
72880
1474
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/tmp45ewwtu9/tmpsv4uz6gs.py", line 66, in <module> resolve() File "/tmp/tmp45ewwtu9/tmpsv4uz6gs.py", line 53, in resolve n, m = [int(x) for x in input().rstrip().split(" ")] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmp45ewwtu9/tmpsv4u...
s475649636
p02536
u923270446
1601169483
Python
Python (3.8.2)
py
Runtime Error
288
26936
409
n, m = map(int, input().split()) edges = [[] for i in range(n)] visit = [False for i in range(n)] def dfs(v): visit[v] = True for i in edges[v]: if not visit[i]: dfs(i) for i in range(m): a, b = map(int, input().split()) edges[a - 1].append(b - 1) edges[b - 1].append(a - 1) cnt =...
Traceback (most recent call last): File "/tmp/tmpsdm59yvm/tmpi6tt_np9.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s763289355
p02536
u460009487
1601169479
Python
PyPy3 (7.3.0)
py
Runtime Error
227
86700
143
n, m = map(int, input().split()) a, b = [list(map(int,input().split())) for i in range(m)] print(a, b) c = a + b c = set(c) print(m-len(c)+1)
Traceback (most recent call last): File "/tmp/tmpvjy1i_i0/tmp0r6ljhgv.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s062772739
p02536
u680814872
1601169478
Python
PyPy3 (7.3.0)
py
Runtime Error
1509
772736
819
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Sep 26 17:37:27 2020 @author: divyarth """ import sys import heapq import math sys.setrecursionlimit(10000) #input=sys.stdin.readline #print=sys.stdout.write from collections import deque from collections import defaultdict from collections import Co...
Traceback (most recent call last): File "/tmp/tmp_3p7y9nq/tmpka6b4xps.py", line 26, in <module> n,m=I() ^^^ File "/tmp/tmp_3p7y9nq/tmpka6b4xps.py", line 23, in <lambda> I=lambda : list(map(int,input().split(' '))) ^^^^^^^ EOFError: EOF when reading a line
s205963287
p02536
u371132735
1601169474
Python
Python (3.8.2)
py
Runtime Error
246
18916
884
class path_compressed_quick_union: def __init__(self, n): self.n = n self.data = [i for i in range(n)] self.size = [1 for i in range(n)] def root(self, p): while p != self.data[p]: self.data[p] = self.data[self.data[p]] p = self.data[p] return p ...
Traceback (most recent call last): File "/tmp/tmpfog6azgy/tmpuc4dy9ke.py", line 28, in <module> N, M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s728969161
p02536
u682467216
1601169473
Python
PyPy3 (7.3.0)
py
Runtime Error
232
80112
2536
# coding=utf-8 from math import floor, ceil, sqrt, factorial, log, gcd, log10 from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain from bisect import bisect_left, bisect_right from collections import Counter, defaultdict, deque from heapq import heappop, heappush, ...
Traceback (most recent call last): File "/tmp/tmpvtazp6ht/tmprcvs5ods.py", line 118, in <module> n, m = LI() ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s646186075
p02536
u813042907
1601169447
Python
Python (3.8.2)
py
Runtime Error
27
9180
146
n,m=map(int,input().split()) list=[] for i in range(m): list.append([]) list[i].append(int(input())) list[i].append(int(input())) print(n-m)
Traceback (most recent call last): File "/tmp/tmpl7tstrhj/tmpasl11tqb.py", line 1, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s133818891
p02536
u125205981
1601169439
Python
Python (3.8.2)
py
Runtime Error
368
58632
524
from scipy.sparse.csgraph import connected_components from scipy.sparse import csr_matrix from sys import stdin def makeConnected(n, connections): l = list(zip(*connections)) d = [1] * len(connections) a = csr_matrix((d, (l[0], l[1])), (n, n)) return connected_components(a, return_labels=0) def main...
Traceback (most recent call last): File "/tmp/tmp4pb32dpq/tmp03oe11sh.py", line 22, in <module> main() File "/tmp/tmp4pb32dpq/tmp03oe11sh.py", line 15, in main N, M = map(int, input().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s180973592
p02536
u255898796
1601169428
Python
Python (3.8.2)
py
Runtime Error
316
40052
1433
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/tmp54xjlqu3/tmpk06pc4i6.py", line 48, in <module> a = input().split() ^^^^^^^ EOFError: EOF when reading a line
s534899593
p02536
u136843617
1601169428
Python
Python (3.8.2)
py
Runtime Error
238
26328
1701
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/tmp683mhq9k/tmpw3be35pw.py", line 63, in <module> N,M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s752736768
p02536
u745561510
1601169415
Python
Python (3.8.2)
py
Runtime Error
2206
26992
543
N, M = map(int, input().split()) G = [[] for _ in range(N)] seen = [False] * N for _ in range(M): A, B = map(lambda x: int(x) - 1, input().split()) G[A].append(B) G[B].append(A) def dfs(x, G, seen, before): seen[x] = True for next in G[x]: if next == before: continue i...
Traceback (most recent call last): File "/tmp/tmp0ccp4c_t/tmpn9aght9u.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s800072337
p02536
u990726146
1601169408
Python
Python (3.8.2)
py
Runtime Error
308
27832
1399
N, M = map(int, input().split()) ab = [0] * M for i in range(M): ab[i] = list(map(int, input().split())) import sys sys.setrecursionlimit(100500) class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: ret...
Traceback (most recent call last): File "/tmp/tmpcbt2i953/tmprvk30u1j.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s677725103
p02536
u085186789
1601169406
Python
Python (3.8.2)
py
Runtime Error
26
9160
144
N, M = map(int,input().split()) for x in range(1, M - 1): print('{0:2d} {1:3d} {2:4d}'.format(int(input()), int(input()))) print(N - (M + 1))
Traceback (most recent call last): File "/tmp/tmpv87nuz7v/tmpnzjtzaap.py", line 1, in <module> N, M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s737449195
p02536
u575239123
1601169399
Python
Python (3.8.2)
py
Runtime Error
214
12764
1211
n,m=map(int,input().split()) #素集合 無向グラフ 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 = sel...
Traceback (most recent call last): File "/tmp/tmpc4bbc2i_/tmpcedjih8a.py", line 1, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s550274664
p02536
u111822487
1601169395
Python
PyPy3 (7.3.0)
py
Runtime Error
96
68840
214
import numpy as np l = input().split() N = int(l[0]) M = int(l[1]) arr = [0]*N for i in range(M): l = input().split() #A[i] = l[0] #B[i] = l[1] arr[int(l[0])] = 1 arr[int(l[1])] = 1 print(N-np.sum(arr))
Traceback (most recent call last): File "/tmp/tmpz4t00p4d/tmpezu7069j.py", line 3, in <module> l = input().split() ^^^^^^^ EOFError: EOF when reading a line
s934908972
p02536
u145915236
1601169385
Python
PyPy3 (7.3.0)
py
Runtime Error
301
79972
1346
from sys import setrecursionlimit class UnionFind: def __init__(self, n): self._n = n self.parent_or_size = [-1] * n def union(self, a, b): assert 0 <= a < self._n assert 0 <= b < self._n x, y = self.find(a), self.find(b) if x == y: return x if -self.par...
Traceback (most recent call last): File "/tmp/tmpn3zuxpy8/tmpu3f_d8my.py", line 39, in <module> N, M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s711353638
p02536
u802781234
1601169385
Python
PyPy3 (7.3.0)
py
Runtime Error
323
95820
749
def N(): return int(input()) def L(): return list(map(int,input().split())) def NL(n): return [list(map(int,input().split())) for i in range(n)] mod = pow(10,9)+7 #import numpy as np import sys import math import collections par = [] def init(n): for i in range(n): par.append(i) def root(x): ...
Traceback (most recent call last): File "/tmp/tmpuiie2icj/tmprwj04lns.py", line 36, in <module> n,m = L() ^^^ File "/tmp/tmpuiie2icj/tmprwj04lns.py", line 4, in L return list(map(int,input().split())) ^^^^^^^ EOFError: EOF when reading a line
s069409330
p02536
u793868662
1601169377
Python
PyPy3 (7.3.0)
py
Runtime Error
285
75424
1545
def resolve(): 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 s...
Traceback (most recent call last): File "/tmp/tmpnqyuyof2/tmp_mg63g02.py", line 60, in <module> resolve() File "/tmp/tmpnqyuyof2/tmp_mg63g02.py", line 49, in resolve n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s048473592
p02536
u531599639
1601169358
Python
Python (3.8.2)
py
Runtime Error
2206
13264
1300
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/tmpo9bifxpu/tmp3ptiwit9.py", line 48, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s742565648
p02536
u028973125
1601169351
Python
Python (3.8.2)
py
Runtime Error
143
13004
1340
import sys 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): ...
Traceback (most recent call last): File "/tmp/tmpgoxg5kuv/tmpxm5o5ta4.py", line 51, in <module> N, M = map(int, input().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s303641397
p02536
u414920281
1601169341
Python
PyPy3 (7.3.0)
py
Runtime Error
301
74824
1744
class UnionFind: def __init__(self,n): self.n=n self.parent=[i for i in range(n)] self.rank=[1]*n#木の高さ self.size=[1]*n#size[i]はiを根とするグループのサイズ def find(self,x):#xの根(親)を返す if self.parent[x]==x: return x else: self.parent[x]=self.find(self.pa...
Traceback (most recent call last): File "/tmp/tmpjx8xjnoz/tmpydvpyvz2.py", line 47, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s156116419
p02536
u452512115
1601169329
Python
Python (3.8.2)
py
Runtime Error
230
18876
1470
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/tmpaqzpnd0r/tmpecfftuck.py", line 49, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s986017675
p02536
u607884285
1601169317
Python
Python (3.8.2)
py
Runtime Error
198
10620
778
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/tmpt8ivvsxj/tmpa8ahctvn.py", line 25, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s176005574
p02536
u895408600
1601169292
Python
Python (3.8.2)
py
Runtime Error
300
28076
1298
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 = se...
Traceback (most recent call last): File "/tmp/tmpgvxio1fu/tmponex1knk.py", line 36, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s993794652
p02536
u145915236
1601169279
Python
PyPy3 (7.3.0)
py
Runtime Error
308
80000
1284
class UnionFind: def __init__(self, n): self._n = n self.parent_or_size = [-1] * n def union(self, a, b): assert 0 <= a < self._n assert 0 <= b < self._n x, y = self.find(a), self.find(b) if x == y: return x if -self.parent_or_size[x] < -self.parent_or_si...
Traceback (most recent call last): File "/tmp/tmpv8n3y362/tmpi9mpthoc.py", line 37, in <module> N, M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s065165517
p02536
u519339498
1601169270
Python
Python (3.8.2)
py
Runtime Error
132
12880
1883
''' Created on 2020/09/26 @author: harurun ''' #UnionFind(要素数)で初期化 class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n #parents 各要素の親番号を格納するリストを返す #要素xが属するグループを返す def find(self, x): if self.parents[x] < 0: return x else: ...
Traceback (most recent call last): File "/tmp/tmpawp_br3_/tmpjg4ms_fr.py", line 75, in <module> main() File "/tmp/tmpawp_br3_/tmpjg4ms_fr.py", line 67, in main N,M=map(int,pin().split()) ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s602304799
p02536
u990726146
1601169228
Python
Python (3.8.2)
py
Runtime Error
316
27996
1356
N, M = map(int, input().split()) ab = [0] * M for i in range(M): ab[i] = list(map(int, input().split())) 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.paren...
Traceback (most recent call last): File "/tmp/tmpkyh40wzl/tmpd_36mwtd.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s810595763
p02536
u516483179
1601169198
Python
PyPy3 (7.3.0)
py
Runtime Error
267
75304
1305
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/tmpca19c_e9/tmp1hjsjqd0.py", line 50, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s293188367
p02536
u226849101
1601169192
Python
Python (3.8.2)
py
Runtime Error
2248
3530280
385
import numpy as np from scipy.sparse.csgraph import connected_components N,M = map(int, input().split()) A = [-1 for i in range(M)] B = [-1 for i in range(M)] mat = np.zeros((N,N),dtype=np.uint8) for i in range(M): A[i],B[i] = map(int, input().split()) for i in range(M): mat[A[i]-1][B[i]-1] = 1 mat[B[i]-...
Traceback (most recent call last): File "/tmp/tmpukaswxef/tmpleqi154h.py", line 3, in <module> N,M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s966267805
p02536
u693666240
1601169176
Python
PyPy3 (7.3.0)
py
Runtime Error
425
108680
580
mod = 10**9 + 7 def go(v): global used, g used[v] = True for i in range(len(g[v])): if used[g[v][i]] == False: go(g[v][i]) def solve(): n, m = map(int, input().split()) ans = 0 global g, used g = [[] for i in range(n + 1)] used = [False for i in range(n + 1)] for ...
Traceback (most recent call last): File "/tmp/tmp3_eo0uvx/tmphdlxqpfz.py", line 25, in <module> solve() File "/tmp/tmp3_eo0uvx/tmphdlxqpfz.py", line 9, in solve n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s544806915
p02536
u509661905
1601169166
Python
Python (3.8.2)
py
Runtime Error
27
9096
685
#!/usr/bin/env python3 # from typing import * import atcoder.dsu # def solve(N: int, M: int, A: List[int], B: List[int]) -> int: def solve(N, M, A, B): dsu = atcoder.dsu.DSU(N) for i in range(M): dsu.merge(A[i] - 1, B[i] - 1) num_groups = len(dsu.groups()) return num_groups - 1 # generated ...
Traceback (most recent call last): File "/tmp/tmposnqzv8i/tmpi8e2spi_.py", line 4, in <module> import atcoder.dsu ModuleNotFoundError: No module named 'atcoder'
s443014671
p02536
u760771686
1601169146
Python
PyPy3 (7.3.0)
py
Runtime Error
270
75364
1301
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/tmpikdbkedq/tmp05ha5hk4.py", line 48, in <module> N, M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s433069475
p02536
u651109406
1601169144
Python
Python (3.8.2)
py
Runtime Error
37
10580
721
class unionfind(): def __init__(self, n): self.parents = [-1 for i in range(n)] def find(self, a): if self.parents[a] < 0: return a self.parents[a] = self.find(a) return self.parents[a] def union(self, x, y): x, y = self.find(x), self.find(y) ...
Traceback (most recent call last): File "/tmp/tmp6i2v1h88/tmpqcp4cam6.py", line 23, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s215186030
p02536
u457460736
1601169139
Python
Python (3.8.2)
py
Runtime Error
217
15936
1607
import math import collections import itertools import copy def YesNo(Bool): if(Bool): print("YES") else: print("NO") return class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: ...
Traceback (most recent call last): File "/tmp/tmp048x1828/tmpz73wuvhm.py", line 78, in <module> resolve() File "/tmp/tmp048x1828/tmpz73wuvhm.py", line 62, in resolve N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s519676777
p02536
u531599639
1601169138
Python
Python (3.8.2)
py
Runtime Error
203
12784
1289
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/tmpuec9gqim/tmpf28f11kz.py", line 48, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s097887858
p02536
u680814872
1601169132
Python
PyPy3 (7.3.0)
py
Runtime Error
1450
773396
841
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Sep 26 17:37:27 2020 @author: divyarth """ import sys import heapq import math sys.setrecursionlimit(10000) #input=sys.stdin.readline #print=sys.stdout.write from collections import deque from collections import defaultdict from collections import Co...
Traceback (most recent call last): File "/tmp/tmpjj4rrk9h/tmp0x_4y1x7.py", line 25, in <module> n,m=I() ^^^ File "/tmp/tmpjj4rrk9h/tmp0x_4y1x7.py", line 22, in <lambda> I=lambda : list(map(int,input().split(' '))) ^^^^^^^ EOFError: EOF when reading a line
s419815142
p02536
u758815106
1601169130
Python
Python (3.8.2)
py
Runtime Error
337
29216
2195
import types _atcoder_code = """ # Python port of AtCoder Library. __version__ = '0.0.1' """ atcoder = types.ModuleType('atcoder') exec(_atcoder_code, atcoder.__dict__) _atcoder_dsu_code = """ import typing class DSU: ''' Implement (union by size) + (path compression) Reference: Zvi Galil and Gius...
Traceback (most recent call last): File "/tmp/tmpffmgk1fe/tmplifi5iqp.py", line 88, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s153209351
p02536
u289547799
1601169128
Python
PyPy3 (7.3.0)
py
Runtime Error
321
107788
470
n, m = map(int, input().split()) # n = (頂点の数), m = (辺の数) graph = [[] for _ in range(n)] for i in range(m): a, b = map(int, input().split()) graph[a-1].append(b) graph[b-1].append(a) seen = [False]*n def dfs(v): global graph global seen seen[v] = True for next_v in graph[v]: if seen[next_v-1]: ...
Traceback (most recent call last): File "/tmp/tmp6jnz1z2r/tmpjt_jlp5m.py", line 1, in <module> n, m = map(int, input().split()) # n = (頂点の数), m = (辺の数) ^^^^^^^ EOFError: EOF when reading a line