Submission #75081072


Source Code Expand

# DFSっぽい?
# 448-Dっぽい
import sys

sys.setrecursionlimit(10**7)

N, M = map(int, input().split())
edges = [[] for _ in range(N + 1)]
for i in range(M):
    A, B = map(int, input().split())
    edges[A].append(B)
visited = set()


def dfs(now):
    visited.add(now)
    for to in edges[now]:
        if to not in visited:
            dfs(to)


dfs(1)
print(len(visited))

Submission Info

Submission Time
Task C - Straw Millionaire
User msd7
Language Python (PyPy 3.11-v7.3.20)
Score 300
Code Size 405 Byte
Status AC
Exec Time 1058 ms
Memory 463036 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 22
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 01_handmade_09.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 03_killer_00.txt, 03_killer_01.txt, 03_killer_02.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 55 ms 80108 KiB
00_sample_01.txt AC 56 ms 79952 KiB
00_sample_02.txt AC 57 ms 80120 KiB
01_handmade_00.txt AC 357 ms 129284 KiB
01_handmade_01.txt AC 354 ms 129008 KiB
01_handmade_02.txt AC 348 ms 126516 KiB
01_handmade_03.txt AC 371 ms 121060 KiB
01_handmade_04.txt AC 366 ms 122200 KiB
01_handmade_05.txt AC 1058 ms 463036 KiB
01_handmade_06.txt AC 1029 ms 462900 KiB
01_handmade_07.txt AC 717 ms 221840 KiB
01_handmade_08.txt AC 709 ms 222036 KiB
01_handmade_09.txt AC 264 ms 133416 KiB
02_random_00.txt AC 525 ms 135568 KiB
02_random_01.txt AC 451 ms 136548 KiB
02_random_02.txt AC 287 ms 116128 KiB
02_random_03.txt AC 529 ms 143760 KiB
02_random_04.txt AC 412 ms 121740 KiB
02_random_05.txt AC 402 ms 118836 KiB
03_killer_00.txt AC 495 ms 224144 KiB
03_killer_01.txt AC 853 ms 453668 KiB
03_killer_02.txt AC 631 ms 384772 KiB