Submission #10071680
Source Code Expand
import sys input = sys.stdin.buffer.readline from collections import deque def main(): N,M = map(int,input().split()) lang = [[] for _ in range(M)] for i in range(N): info = list(map(int,input().split())) info.pop(0) for num in info: lang[num-1].append(i) con = [[] for _ in range(N)] for s in lang: l = len(s) if l>1: for i in range(l-1): con[s[i]].append(s[i+1]) con[s[i+1]].append(s[i]) go = [False for _ in range(N)] go[0] = True que = deque([0]) while que: now = que.pop() for fol in con[now]: if go[fol]: continue else: que.append(fol) go[fol] = True print("YES" if all(go) else "NO") if __name__ == "__main__": main()
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | delocalized |
Language | Python (3.4.3) |
Score | 400 |
Code Size | 909 Byte |
Status | AC |
Exec Time | 301 ms |
Memory | 27044 KB |
Judge Result
Set Name | sample | dataset1 | dataset2 | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | 200 / 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 | 21 ms | 3316 KB |
01-02.txt | AC | 21 ms | 3436 KB |
01-03.txt | AC | 23 ms | 3564 KB |
01-04.txt | AC | 23 ms | 3436 KB |
01-05.txt | AC | 23 ms | 3436 KB |
01-06.txt | AC | 22 ms | 3436 KB |
01-07.txt | AC | 22 ms | 3436 KB |
01-08.txt | AC | 23 ms | 3436 KB |
01-09.txt | AC | 23 ms | 3436 KB |
01-10.txt | AC | 24 ms | 3564 KB |
02-01.txt | AC | 129 ms | 14904 KB |
02-02.txt | AC | 288 ms | 19684 KB |
02-03.txt | AC | 127 ms | 11708 KB |
02-04.txt | AC | 238 ms | 21900 KB |
02-05.txt | AC | 282 ms | 18096 KB |
02-06.txt | AC | 256 ms | 21880 KB |
02-07.txt | AC | 301 ms | 19660 KB |
02-08.txt | AC | 254 ms | 19920 KB |
02-09.txt | AC | 293 ms | 27044 KB |
02-10.txt | AC | 172 ms | 17416 KB |
02-11.txt | AC | 174 ms | 17428 KB |
02-12.txt | AC | 175 ms | 17360 KB |
02-13.txt | AC | 179 ms | 17456 KB |
sample-01.txt | AC | 21 ms | 3316 KB |
sample-02.txt | AC | 21 ms | 3316 KB |