Submission #1201415


Source Code Expand

[N, M] = map(int, raw_input().split(' '))
arr = [[False] * N for i in range(N)]
language = []
for i in range(N):
    language.append(set(raw_input().split(' ')[1:]))

modified = True
while modified:
    is_modified = False
    for i in range(N):
        for j in range(N-i):
            print i, i + j
            if i == i + j:
                continue
            elif arr[i][i+j] == True:
                continue
            else:
                # First check language
                if len(language[i].intersection(language[i+j])) > 0:
                    arr[i][i + j] = True
                    arr[i+j][i] = True
                    is_modified = True
                # Then check neighbour
                else:
                    for a in range(N):
                        if arr[i][a] == True and arr[i+j][a] == True:
                            arr[i][i + j] = True
                            arr[i+j][i] = True
                            is_modified = True
                            break
    modified = is_modified

for i in range(N):
    for j in range(N-i):
        if arr[i][i+j] != True:
            print "No"
            exit()
print "Yes"

Submission Info

Submission Time
Task C - Interpretation
User kingloo
Language Python (2.7.6)
Score 0
Code Size 1205 Byte
Status WA
Exec Time 2232 ms
Memory 1942404 KB

Judge Result

Set Name sample dataset1 dataset2
Score / Max Score 0 / 0 0 / 200 0 / 200
Status
WA × 2
WA × 5
TLE × 7
WA × 7
TLE × 20
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 WA 10 ms 2696 KB
01-02.txt WA 22 ms 2820 KB
01-03.txt TLE 2104 ms 11012 KB
01-04.txt TLE 2104 ms 11012 KB
01-05.txt TLE 2104 ms 9476 KB
01-06.txt TLE 2104 ms 5508 KB
01-07.txt TLE 2104 ms 4996 KB
01-08.txt TLE 2104 ms 5508 KB
01-09.txt TLE 2104 ms 5892 KB
01-10.txt WA 1184 ms 18436 KB
02-01.txt TLE 2116 ms 210052 KB
02-02.txt TLE 2220 ms 1883012 KB
02-03.txt TLE 2155 ms 797788 KB
02-04.txt TLE 2197 ms 1492612 KB
02-05.txt TLE 2202 ms 1556484 KB
02-06.txt TLE 2196 ms 1488644 KB
02-07.txt TLE 2211 ms 1744516 KB
02-08.txt TLE 2229 ms 1942404 KB
02-09.txt TLE 2232 ms 1942404 KB
02-10.txt TLE 2201 ms 1522308 KB
02-11.txt TLE 2201 ms 1522308 KB
02-12.txt TLE 2200 ms 1522308 KB
02-13.txt TLE 2202 ms 1522308 KB
sample-01.txt WA 10 ms 2696 KB
sample-02.txt WA 10 ms 2696 KB