Submission #7900911
Source Code Expand
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 9) N,M = map(int,input().split()) L = [] for i in range(N): tmp = list(map(int,input().split())) L.append(tmp[1:]) dicL = {} for i in range(N): for l in L[i]: if l not in dicL: dicL[l] = [i] else: dicL[l].append(i) #print(dicL) E = [set() for _ in range(N)] for k,v in dicL.items(): if len(v) > 1: for i in range(len(v)-1): for j in range(i+1,len(v)): E[v[i]].add(v[j]) E[v[j]].add(v[i]) #print(E) Visited = [0 for _ in range(N)] def dfs(v): Visited[v] = 1 for u in E[v]: if Visited[u] == 0: dfs(u) dfs(0) print('YES' if sum(Visited) == N else 'NO')
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | useless |
Language | PyPy3 (2.4.0) |
Score | 200 |
Code Size | 724 Byte |
Status | TLE |
Exec Time | 2151 ms |
Memory | 883080 KB |
Judge Result
Set Name | sample | dataset1 | dataset2 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | 0 / 200 | ||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
sample | sample-01.txt, sample-02.txt |
dataset1 | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt |
dataset2 | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt, 02-13.txt, sample-01.txt, sample-02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 173 ms | 38384 KB |
01-02.txt | AC | 175 ms | 38512 KB |
01-03.txt | AC | 187 ms | 38768 KB |
01-04.txt | AC | 247 ms | 79324 KB |
01-05.txt | AC | 202 ms | 42604 KB |
01-06.txt | AC | 182 ms | 39152 KB |
01-07.txt | AC | 191 ms | 40304 KB |
01-08.txt | AC | 183 ms | 39152 KB |
01-09.txt | AC | 187 ms | 39792 KB |
01-10.txt | AC | 265 ms | 82140 KB |
02-01.txt | AC | 335 ms | 67164 KB |
02-02.txt | TLE | 2138 ms | 883080 KB |
02-03.txt | AC | 389 ms | 83292 KB |
02-04.txt | AC | 456 ms | 87260 KB |
02-05.txt | AC | 945 ms | 140552 KB |
02-06.txt | AC | 461 ms | 89308 KB |
02-07.txt | AC | 584 ms | 120668 KB |
02-08.txt | TLE | 2149 ms | 742152 KB |
02-09.txt | TLE | 2132 ms | 609912 KB |
02-10.txt | TLE | 2149 ms | 771024 KB |
02-11.txt | TLE | 2150 ms | 765976 KB |
02-12.txt | TLE | 2151 ms | 748680 KB |
02-13.txt | TLE | 2149 ms | 748296 KB |
sample-01.txt | AC | 170 ms | 38256 KB |
sample-02.txt | AC | 170 ms | 38256 KB |