Submission #1176846
Source Code Expand
import sys N, M = map(int, input().split()) can_talk = [i for i in range(N)] lang = [[] for _ in range(M)] for i in range(N): L = [int(i) for i in input().split()] L.reverse() L.pop() for l in L: if lang[l-1]: can_talk[lang[l-1][0]] = i else: lang[l-1].append(i) for i in range(N): s = i p = [] while s != can_talk[s]: p.append(s) s = can_talk[s] for x in p: can_talk[x] = s if can_talk.count(can_talk[0]) == N: print("YES") else: print("NO")
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | TAB |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 502 Byte |
Status | WA |
Exec Time | 2104 ms |
Memory | 14128 KB |
Judge Result
Set Name | sample | dataset1 | dataset2 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 19 ms | 3064 KB |
01-03.txt | AC | 294 ms | 3064 KB |
01-04.txt | WA | 242 ms | 3064 KB |
01-05.txt | AC | 235 ms | 3064 KB |
01-06.txt | WA | 116 ms | 3064 KB |
01-07.txt | WA | 97 ms | 3064 KB |
01-08.txt | AC | 120 ms | 3064 KB |
01-09.txt | WA | 133 ms | 3064 KB |
01-10.txt | WA | 239 ms | 3064 KB |
02-01.txt | TLE | 2104 ms | 11608 KB |
02-02.txt | TLE | 2104 ms | 6960 KB |
02-03.txt | TLE | 2104 ms | 9084 KB |
02-04.txt | TLE | 2104 ms | 12464 KB |
02-05.txt | TLE | 2104 ms | 6832 KB |
02-06.txt | TLE | 2104 ms | 12464 KB |
02-07.txt | TLE | 2104 ms | 7344 KB |
02-08.txt | TLE | 2104 ms | 7088 KB |
02-09.txt | TLE | 2104 ms | 14128 KB |
02-10.txt | TLE | 2104 ms | 8624 KB |
02-11.txt | TLE | 2104 ms | 8624 KB |
02-12.txt | TLE | 2104 ms | 8624 KB |
02-13.txt | TLE | 2104 ms | 8624 KB |
sample-01.txt | AC | 17 ms | 3064 KB |
sample-02.txt | AC | 17 ms | 3064 KB |