Submission #7904613
Source Code Expand
import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline 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 = [[] 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]].append(v[j]) E[v[j]].append(v[i]) for i in range(N): E[i] = set(E[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 | 761 Byte |
Status | TLE |
Exec Time | 2110 ms |
Memory | 124260 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 | 17 ms | 3064 KB |
01-02.txt | AC | 19 ms | 3188 KB |
01-03.txt | AC | 21 ms | 3444 KB |
01-04.txt | AC | 203 ms | 36340 KB |
01-05.txt | AC | 25 ms | 3956 KB |
01-06.txt | AC | 21 ms | 3316 KB |
01-07.txt | AC | 21 ms | 3572 KB |
01-08.txt | AC | 21 ms | 3372 KB |
01-09.txt | AC | 22 ms | 3444 KB |
01-10.txt | AC | 335 ms | 36724 KB |
02-01.txt | AC | 210 ms | 27552 KB |
02-02.txt | TLE | 2110 ms | 103364 KB |
02-03.txt | AC | 282 ms | 35496 KB |
02-04.txt | AC | 453 ms | 40232 KB |
02-05.txt | AC | 1088 ms | 124260 KB |
02-06.txt | AC | 445 ms | 40316 KB |
02-07.txt | AC | 992 ms | 94904 KB |
02-08.txt | TLE | 2109 ms | 97096 KB |
02-09.txt | TLE | 2109 ms | 97528 KB |
02-10.txt | TLE | 2110 ms | 103828 KB |
02-11.txt | TLE | 2110 ms | 104340 KB |
02-12.txt | TLE | 2109 ms | 102860 KB |
02-13.txt | TLE | 2110 ms | 104008 KB |
sample-01.txt | AC | 17 ms | 3064 KB |
sample-02.txt | AC | 17 ms | 3064 KB |