Submission #7900935
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 | Python (3.4.3) |
Score | 200 |
Code Size | 726 Byte |
Status | TLE |
Exec Time | 2138 ms |
Memory | 566924 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 | 18 ms | 3064 KB |
01-02.txt | AC | 19 ms | 3188 KB |
01-03.txt | AC | 21 ms | 3444 KB |
01-04.txt | AC | 202 ms | 35956 KB |
01-05.txt | AC | 25 ms | 3956 KB |
01-06.txt | AC | 21 ms | 3316 KB |
01-07.txt | AC | 21 ms | 3440 KB |
01-08.txt | AC | 21 ms | 3316 KB |
01-09.txt | AC | 21 ms | 3316 KB |
01-10.txt | AC | 334 ms | 36340 KB |
02-01.txt | AC | 214 ms | 27936 KB |
02-02.txt | TLE | 2138 ms | 566924 KB |
02-03.txt | AC | 276 ms | 36008 KB |
02-04.txt | AC | 429 ms | 38704 KB |
02-05.txt | AC | 985 ms | 122116 KB |
02-06.txt | AC | 432 ms | 38752 KB |
02-07.txt | AC | 921 ms | 92500 KB |
02-08.txt | TLE | 2119 ms | 260976 KB |
02-09.txt | TLE | 2123 ms | 387436 KB |
02-10.txt | TLE | 2120 ms | 284308 KB |
02-11.txt | TLE | 2119 ms | 282268 KB |
02-12.txt | TLE | 2120 ms | 272592 KB |
02-13.txt | TLE | 2120 ms | 267336 KB |
sample-01.txt | AC | 18 ms | 3064 KB |
sample-02.txt | AC | 17 ms | 3064 KB |