CODE FESTIVAL 2016 Final

Submission #1757014

Source codeソースコード

class Graph():
    def __init__(self,V):
        self.V = V
        self.verts = list(range(V))
        self.edges = [[] for _ in range(V)]
        self.E = 0

    def addEdge(self,f,t):
        self.edges[f].append(t)
        self.E += 1

    def deletebfs(self):
        queue = []
        queue.append(0)
        while queue != []:
            f = queue[0]
            queue.pop(0)
            for i in range(len(self.edges[f])):
                t = self.edges[f][-1]
                queue.append(t)
                self.edges[f].pop(-1)
                self.edges[t].pop(self.edges[t].index(f))
                self.E -= 2


if __name__ == '__main__':

    n,m = map(int, input().split(" "))
    k = [None for _ in range(n)]
    l = [[] for _ in range(n)]
    edge_num = 0
    for i in range(n):
        p = list(map(int, input().split(" ")))
        k[i] = p[0]
        l[i] = p[1:]
        edge_num += k[i]

    g = Graph(n+m)
    for i in range(n):
        for j in range(len(l[i])):
            person = i
            lang = l[i][j]+n-1
            g.addEdge(person,lang)
            g.addEdge(lang,person)
    g.deletebfs()
    if g.E == 0:
        print('YES')
    else:
        print('NO')

Submission

Task問題 C - Interpretation
User nameユーザ名 yuinityk
Created time投稿日時
Language言語 Python3 (3.4.3)
Status状態 TLE
Score得点 200
Source lengthソースコード長 1248 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

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 0 / 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 18 ms 3064 KB
01-02.txt AC 22 ms 3188 KB
01-03.txt AC 24 ms 3444 KB
01-04.txt AC 26 ms 3316 KB
01-05.txt AC 25 ms 3316 KB
01-06.txt AC 24 ms 3316 KB
01-07.txt AC 24 ms 3188 KB
01-08.txt AC 24 ms 3316 KB
01-09.txt AC 24 ms 3316 KB
01-10.txt AC 26 ms 3444 KB
02-01.txt AC 1152 ms 26836 KB
02-02.txt AC 1385 ms 39512 KB
02-03.txt AC 1286 ms 23896 KB
02-04.txt AC 672 ms 39504 KB
02-05.txt AC 1136 ms 36300 KB
02-06.txt AC 691 ms 39396 KB
02-07.txt AC 766 ms 39016 KB
02-08.txt AC 1034 ms 37588 KB
02-09.txt TLE
02-10.txt AC 1523 ms 34024 KB
02-11.txt AC 1698 ms 34408 KB
02-12.txt AC 610 ms 33200 KB
02-13.txt AC 691 ms 33328 KB
sample-01.txt AC 18 ms 3064 KB
sample-02.txt AC 18 ms 3064 KB