CODE FESTIVAL 2016 Final

Submission #11197268

Source codeソースコード

import sys
input = sys.stdin.readline

n, m = map(int, input().split())
g = [[] for _ in range(n)]
d = {}
for i in range(n):
    kl = list(map(int, input().split()))
    L = kl[1:]
    L = [l-1 for l in L]
    for l in L:
        if l not in d:
            d[l] = i
        else:
            g[d[l]].append(i)
            g[i].append(d[l])

from collections import deque
s = deque()
s.append(0)
visit = [-1]*n
visit[0] = 0
while s:
    x = s.pop()
    for nx in g[x]:
        if visit[nx] == -1:
            visit[nx] = 0
            s.append(nx)
if min(visit) != -1:
    print('YES')
else:
    print('NO')

Submission

Task問題 C - Interpretation
User nameユーザ名 brthyyjp
Created time投稿日時
Language言語 PyPy3 (2.4.0)
Status状態 AC
Score得点 400
Source lengthソースコード長 637 Byte
File nameファイル名
Exec time実行時間 380 ms
Memory usageメモリ使用量 62256 KB

Test case

Set

Set name Score得点 / Max score Cases
sample - sample-01.txt,sample-02.txt
dataset1 200 / 200 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 200 / 200 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01-01.txt AC 164 ms 38256 KB
01-02.txt AC 167 ms 38512 KB
01-03.txt AC 177 ms 38896 KB
01-04.txt AC 186 ms 39536 KB
01-05.txt AC 183 ms 39152 KB
01-06.txt AC 176 ms 39024 KB
01-07.txt AC 178 ms 39152 KB
01-08.txt AC 176 ms 39024 KB
01-09.txt AC 179 ms 39280 KB
01-10.txt AC 181 ms 39152 KB
02-01.txt AC 250 ms 48220 KB
02-02.txt AC 361 ms 60576 KB
02-03.txt AC 266 ms 50012 KB
02-04.txt AC 340 ms 56044 KB
02-05.txt AC 358 ms 57196 KB
02-06.txt AC 366 ms 57836 KB
02-07.txt AC 380 ms 58476 KB
02-08.txt AC 311 ms 60848 KB
02-09.txt AC 334 ms 62256 KB
02-10.txt AC 300 ms 60656 KB
02-11.txt AC 282 ms 59888 KB
02-12.txt AC 296 ms 57436 KB
02-13.txt AC 285 ms 56028 KB
sample-01.txt AC 168 ms 38256 KB
sample-02.txt AC 163 ms 38256 KB