提出 #75047042


ソースコード 拡げる

// Date: 2026-04-18
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
    bool debug_mode = 1;
#else
    bool debug_mode = 0;
#endif

using ll = long long;
#define cerr if(debug_mode) cerr

int main() {
    cin.tie(0) -> sync_with_stdio(0);
    
    int n, m; cin >> n >> m;
    vector<vector<int>> e(n + 1);
    for (int i = 0; i < m; i++) {
        int u, v; cin >> u >> v;
        e[u].emplace_back(v);
    }

    vector<bool> visi(n + 1);

    auto dfs = [&](auto self, int x) -> void {
        if (visi[x]) return;
        visi[x] = 1;
        for (auto y : e[x]) self(self, y);
    }; dfs(dfs, 1);

    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        cnt += visi[i];
    }

    cout << cnt;
}

提出情報

提出日時
問題 C - Straw Millionaire
ユーザ Emmetthor
言語 C++ IOI-Style(GNU++20) (GCC 14.2.0)
得点 300
コード長 753 Byte
結果 AC
実行時間 149 ms
メモリ 26028 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 22
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 0 ms 1580 KiB
00_sample_01.txt AC 0 ms 1580 KiB
00_sample_02.txt AC 0 ms 1580 KiB
01_handmade_00.txt AC 15 ms 3852 KiB
01_handmade_01.txt AC 15 ms 3852 KiB
01_handmade_02.txt AC 15 ms 3348 KiB
01_handmade_03.txt AC 19 ms 4140 KiB
01_handmade_04.txt AC 20 ms 3884 KiB
01_handmade_05.txt AC 139 ms 26028 KiB
01_handmade_06.txt AC 149 ms 26028 KiB
01_handmade_07.txt AC 79 ms 12460 KiB
01_handmade_08.txt AC 69 ms 12460 KiB
01_handmade_09.txt AC 22 ms 7760 KiB
02_random_00.txt AC 65 ms 15020 KiB
02_random_01.txt AC 30 ms 5164 KiB
02_random_02.txt AC 14 ms 2988 KiB
02_random_03.txt AC 35 ms 5420 KiB
02_random_04.txt AC 22 ms 3500 KiB
02_random_05.txt AC 21 ms 3756 KiB
03_killer_00.txt AC 29 ms 13736 KiB
03_killer_01.txt AC 26 ms 13740 KiB
03_killer_02.txt AC 36 ms 21676 KiB