Submission #4815927


Source Code Expand

Copy
N,M = map(int,input().split())
L = []
for i in range(M):
  L.append(list(map(int,input().split())))
ball = [1]*N
aka = [False]*N
aka[0] = True
for i in range(M):
  if aka[L[i][0]-1] == True:
    aka[L[i][1]-1] = True
  ball[L[i][0]-1] -= 1
  if ball[L[i][0]-1] == 0:
    aka[L[i][0]-1] = False
  ball[L[i][1]-1] += 1
ans = 0
for i in range(N):
  if aka[i] == True:
    ans += 1
print(ans)

Submission Info

Submission Time
Task B - Box and Ball
User Syuko4omi
Language Python3 (3.4.3)
Score 400
Code Size 406 Byte
Status
Exec Time 453 ms
Memory 28964 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_00.txt, 0_01.txt, 0_02.txt
All 400 / 400 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 17 ms 3064 KB
0_01.txt 17 ms 3064 KB
0_02.txt 17 ms 3064 KB
1_00.txt 17 ms 3064 KB
1_01.txt 17 ms 3064 KB
1_02.txt 17 ms 3064 KB
1_03.txt 17 ms 3064 KB
1_04.txt 416 ms 25704 KB
1_05.txt 453 ms 28964 KB
1_06.txt 406 ms 24968 KB
1_07.txt 419 ms 28072 KB
1_08.txt 266 ms 18676 KB
1_09.txt 281 ms 19568 KB
1_10.txt 94 ms 8396 KB
1_11.txt 170 ms 12320 KB
1_12.txt 37 ms 4972 KB
1_13.txt 359 ms 23900 KB
1_14.txt 191 ms 13996 KB
1_15.txt 340 ms 22364 KB
1_16.txt 27 ms 4212 KB
1_17.txt 414 ms 27844 KB
1_18.txt 381 ms 25128 KB
1_19.txt 421 ms 27196 KB
1_20.txt 399 ms 25792 KB
1_21.txt 326 ms 22120 KB
1_22.txt 428 ms 27804 KB
1_23.txt 121 ms 10048 KB