Submission #992461


Source Code Expand

from collections import deque
n, m = map(int, raw_input().split())
g = [[] for i in xrange(m)]
L = [None]*n
for i in xrange(n):
    ipt = map(int, raw_input().split())
    k = ipt[0]
    L[i] = ipt[1:]
    for e in L[i]:
        g[e-1].append(i)
parent = range(n)
def root(x):
    if x == parent[x]:
        return x
    parent[x] = root(parent[x])
    return parent[x]
def unite(x, y):
    px = root(x)
    py = root(y)
    if px < py:
        parent[py] = px
    else:
        parent[px] = py
    return min(px, py)
for e in g:
    for p in e:
        for q in e:
            unite(p, q)
print "YES"*(sum(parent) == 0) or "NO"

Submission Info

Submission Time
Task C - Interpretation
User yaketake08
Language Python (2.7.6)
Score 0
Code Size 658 Byte
Status WA
Exec Time 2104 ms
Memory 30516 KB

Judge Result

Set Name sample dataset1 dataset2
Score / Max Score 0 / 0 0 / 200 0 / 200
Status
AC × 2
AC × 8
WA × 4
AC × 11
WA × 7
TLE × 7
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
Case Name Status Exec Time Memory
01-01.txt AC 20 ms 2936 KB
01-02.txt AC 20 ms 2936 KB
01-03.txt AC 23 ms 3064 KB
01-04.txt WA 500 ms 2936 KB
01-05.txt AC 31 ms 2936 KB
01-06.txt WA 23 ms 2936 KB
01-07.txt WA 23 ms 2936 KB
01-08.txt AC 23 ms 2936 KB
01-09.txt WA 24 ms 2936 KB
01-10.txt AC 989 ms 3064 KB
02-01.txt AC 350 ms 17588 KB
02-02.txt TLE 2103 ms 21752 KB
02-03.txt AC 445 ms 13492 KB
02-04.txt WA 612 ms 24500 KB
02-05.txt WA 1458 ms 20600 KB
02-06.txt AC 614 ms 24500 KB
02-07.txt WA 1493 ms 22264 KB
02-08.txt TLE 2103 ms 20192 KB
02-09.txt TLE 2104 ms 30516 KB
02-10.txt TLE 2103 ms 20512 KB
02-11.txt TLE 2103 ms 20580 KB
02-12.txt TLE 2103 ms 20164 KB
02-13.txt TLE 2103 ms 20184 KB
sample-01.txt AC 17 ms 2808 KB
sample-02.txt AC 17 ms 2808 KB