Submission #73496895


Source Code Expand

#include <algorithm>
#include <iostream>
#include <map>
//#include <numeric>
#include <queue>
//#include <ranges>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define pb push_back
#define fr first
#define sc second
#define sor(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using pint = pair<int,int>;
//using pll = pair<ll,ll>;
using pqdec = priority_queue<int,vector<int>,greater<int>>;
//using pqdecl = priority_queue<ll,vector<ll>,greater<ll>>;
template <typename T>
using graph = vector<vector<T>>;
const ll LLMAX = 9223372*1e10;
const int IMAX = 214*1e7;
/*--------考察--------------------
----------CODING----------------*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    graph<int> g(n);
    rep(i,m){
        int u,v; cin >> u >> v;
        u--; v--;
        g[u].pb(v);
    }
    set<int> q;
    q.insert(0);
    rep(i,n){
        if(*q.begin() == i){
            for(int v : g[i]){
                if(v < i) continue;
                q.insert(v);
            }
            cout << ssize(q)-1 << endl;
            q.erase(i);
        }
        else{
            cout << -1 << endl;
        }
    }
}

Submission Info

Submission Time
Task F - Reachable Set 2
User scotch_at
Language C++23 (GCC 15.2.0)
Score 0
Code Size 1373 Byte
Status WA
Exec Time 241 ms
Memory 25648 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 2
AC × 33
WA × 22
Set Name Test Cases
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, hand_13.txt, hand_14.txt, hand_15.txt, hand_16.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt, random_30.txt, random_31.txt, random_32.txt, random_33.txt, random_34.txt, random_35.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3588 KiB
example_01.txt AC 1 ms 3588 KiB
hand_00.txt AC 159 ms 19752 KiB
hand_01.txt AC 147 ms 16648 KiB
hand_02.txt AC 223 ms 25576 KiB
hand_03.txt WA 223 ms 25648 KiB
hand_04.txt AC 22 ms 5676 KiB
hand_05.txt AC 97 ms 11380 KiB
hand_06.txt AC 226 ms 25616 KiB
hand_07.txt AC 185 ms 22676 KiB
hand_08.txt AC 103 ms 10244 KiB
hand_09.txt AC 1 ms 3572 KiB
hand_10.txt AC 1 ms 3468 KiB
hand_11.txt AC 115 ms 12412 KiB
hand_12.txt AC 194 ms 22068 KiB
hand_13.txt AC 193 ms 22068 KiB
hand_14.txt AC 159 ms 19700 KiB
hand_15.txt AC 139 ms 19756 KiB
hand_16.txt AC 157 ms 19716 KiB
random_00.txt WA 22 ms 4868 KiB
random_01.txt WA 32 ms 5752 KiB
random_02.txt WA 68 ms 9012 KiB
random_03.txt WA 22 ms 5260 KiB
random_04.txt WA 28 ms 5588 KiB
random_05.txt WA 128 ms 14636 KiB
random_06.txt AC 239 ms 20404 KiB
random_07.txt AC 241 ms 20416 KiB
random_08.txt AC 238 ms 20404 KiB
random_09.txt AC 20 ms 5440 KiB
random_10.txt WA 45 ms 6404 KiB
random_11.txt WA 106 ms 12584 KiB
random_12.txt WA 1 ms 3720 KiB
random_13.txt WA 9 ms 4088 KiB
random_14.txt WA 135 ms 14980 KiB
random_15.txt WA 1 ms 3652 KiB
random_16.txt WA 13 ms 4412 KiB
random_17.txt WA 98 ms 11524 KiB
random_18.txt WA 1 ms 3716 KiB
random_19.txt WA 13 ms 4388 KiB
random_20.txt WA 113 ms 12832 KiB
random_21.txt AC 22 ms 5288 KiB
random_22.txt WA 38 ms 6088 KiB
random_23.txt WA 103 ms 12340 KiB
random_24.txt WA 150 ms 13944 KiB
random_25.txt WA 150 ms 13988 KiB
random_26.txt AC 150 ms 14016 KiB
random_27.txt AC 114 ms 11444 KiB
random_28.txt AC 115 ms 11404 KiB
random_29.txt AC 115 ms 11380 KiB
random_30.txt AC 66 ms 7780 KiB
random_31.txt AC 67 ms 7840 KiB
random_32.txt AC 67 ms 7796 KiB
random_33.txt AC 43 ms 6144 KiB
random_34.txt AC 42 ms 6176 KiB
random_35.txt AC 43 ms 6156 KiB