CODE FESTIVAL 2016 Final

Submission #6799178

Source codeソースコード

n,m=map(int,input().split())
p_list=[list(map(lambda x:int(x)-1,input().split()))[1:] for _ in [0]*n]

p_check=[False for _ in [0]*n]
l_check=[False for _ in [0]*m]
l_list=[[] for _ in [0]*m]

for k,i in enumerate(p_list):
    for j in i:
        l_list[j].append(k)

for i,j in enumerate(l_list):
    if j!=[]:
        q=[i]
        break

l_check[q[0]]=True

while q:
    qq=q.pop()
    p=l_list[qq]
    for pp in p:
        if p_check[pp]==False:
            p_check[pp]=True
            for l in p_list[pp]:
                if l_check[l]==False:
                    l_check[l]=True
                    q.append(l)

print(["NO","YES"][all(p_check)])

Submission

Task問題 C - Interpretation
User nameユーザ名 tmg_dayo
Created time投稿日時
Language言語 Python3 (3.4.3)
Status状態 AC
Score得点 400
Source lengthソースコード長 681 Byte
File nameファイル名
Exec time実行時間 492 ms
Memory usageメモリ使用量 30340 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 17 ms 3064 KB
01-02.txt AC 19 ms 3064 KB
01-03.txt AC 22 ms 3316 KB
01-04.txt AC 22 ms 3188 KB
01-05.txt AC 21 ms 3064 KB
01-06.txt AC 22 ms 3188 KB
01-07.txt AC 20 ms 3064 KB
01-08.txt AC 21 ms 3188 KB
01-09.txt AC 20 ms 3188 KB
01-10.txt AC 22 ms 3316 KB
02-01.txt AC 172 ms 18760 KB
02-02.txt AC 463 ms 20712 KB
02-03.txt AC 161 ms 14480 KB
02-04.txt AC 371 ms 24432 KB
02-05.txt AC 431 ms 20064 KB
02-06.txt AC 365 ms 24320 KB
02-07.txt AC 471 ms 21416 KB
02-08.txt AC 427 ms 18916 KB
02-09.txt AC 492 ms 30340 KB
02-10.txt AC 295 ms 21104 KB
02-11.txt AC 299 ms 21132 KB
02-12.txt AC 308 ms 20312 KB
02-13.txt AC 320 ms 20692 KB
sample-01.txt AC 18 ms 3064 KB
sample-02.txt AC 18 ms 3064 KB