Submission #831613


Source Code Expand

import sys
nmlist = list(map(int,input().split(" ")))
N = nmlist[0]
M = nmlist[1]

moves = []
for i in range(M):
    moves.append(list(map(int,input().split(" "))))

box = [[1,0] for i in range(N)]
box[0][1] = 1

for i in range(M):
    before = moves[i][0] - 1
    after = moves[i][1] - 1
    if box[before][0] != 0:
        box[before][0] -= 1
        if box[before][1] == 1:
            box[after][1] = 1
        if box[before][0] == 0:
            box[before][1] = 0
        box[after][0] += 1

output = 0
for i in range(N):
    output += box[i][1]

print(output)

Submission Info

Submission Time
Task B - Box and Ball
User hirorocky
Language Python (3.4.3)
Score 400
Code Size 593 Byte
Status AC
Exec Time 1018 ms
Memory 34632 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 27
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt, 1_22.txt, 1_23.txt
Case Name Status Exec Time Memory
0_00.txt AC 37 ms 3064 KiB
0_01.txt AC 36 ms 3064 KiB
0_02.txt AC 37 ms 3064 KiB
1_00.txt AC 37 ms 3064 KiB
1_01.txt AC 36 ms 3064 KiB
1_02.txt AC 37 ms 3064 KiB
1_03.txt AC 37 ms 3064 KiB
1_04.txt AC 994 ms 31524 KiB
1_05.txt AC 1018 ms 34632 KiB
1_06.txt AC 915 ms 27844 KiB
1_07.txt AC 948 ms 31052 KiB
1_08.txt AC 608 ms 20844 KiB
1_09.txt AC 670 ms 24296 KiB
1_10.txt AC 249 ms 13336 KiB
1_11.txt AC 376 ms 13228 KiB
1_12.txt AC 148 ms 12908 KiB
1_13.txt AC 813 ms 27524 KiB
1_14.txt AC 428 ms 15516 KiB
1_15.txt AC 748 ms 23252 KiB
1_16.txt AC 95 ms 9204 KiB
1_17.txt AC 985 ms 33416 KiB
1_18.txt AC 853 ms 27548 KiB
1_19.txt AC 943 ms 28816 KiB
1_20.txt AC 903 ms 26932 KiB
1_21.txt AC 763 ms 24636 KiB
1_22.txt AC 957 ms 31360 KiB
1_23.txt AC 323 ms 14684 KiB