結果

問題 No.1340 おーじ君をさがせ
ユーザー 👑 zeronosu77108zeronosu77108
提出日時 2021-01-15 22:33:47
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,501 bytes
コンパイル時間 2,014 ms
コンパイル使用メモリ 143,752 KB
実行使用メモリ 28,928 KB
最終ジャッジ日時 2024-05-05 02:53:10
合計ジャッジ時間 4,385 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 RE -
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 5 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 5 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 64 ms
10,880 KB
testcase_22 AC 160 ms
20,352 KB
testcase_23 AC 63 ms
11,136 KB
testcase_24 AC 276 ms
27,392 KB
testcase_25 AC 9 ms
5,376 KB
testcase_26 AC 8 ms
5,376 KB
testcase_27 AC 5 ms
5,376 KB
testcase_28 AC 13 ms
5,760 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 68 ms
11,392 KB
testcase_31 AC 293 ms
28,928 KB
testcase_32 AC 5 ms
5,376 KB
testcase_33 AC 4 ms
5,376 KB
testcase_34 AC 36 ms
8,960 KB
testcase_35 AC 38 ms
9,216 KB
testcase_36 AC 1 ms
5,376 KB
testcase_37 AC 3 ms
5,376 KB
testcase_38 AC 3 ms
5,376 KB
testcase_39 AC 10 ms
5,376 KB
testcase_40 AC 6 ms
5,376 KB
testcase_41 AC 6 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
testcase_43 AC 1 ms
5,376 KB
testcase_44 AC 2 ms
5,376 KB
testcase_45 AC 1 ms
5,376 KB
testcase_46 AC 14 ms
5,504 KB
testcase_47 AC 17 ms
5,504 KB
testcase_48 AC 19 ms
6,016 KB
testcase_49 AC 5 ms
5,376 KB
testcase_50 AC 9 ms
5,376 KB
testcase_51 AC 8 ms
5,376 KB
testcase_52 AC 2 ms
5,376 KB
testcase_53 AC 2 ms
5,376 KB
testcase_54 AC 2 ms
5,376 KB
testcase_55 AC 20 ms
6,656 KB
testcase_56 AC 1 ms
5,376 KB
testcase_57 AC 1 ms
5,376 KB
testcase_58 AC 1 ms
5,376 KB
testcase_59 AC 2 ms
5,376 KB
testcase_60 RE -
testcase_61 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//
// Created by zeronosu77108 on Jan 15, 2021.
//
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>
#include <complex>
#include <optional>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<(v)<<endl;}

using int64 = long long;

int main() {
    int n, m;
    long t;
    cin >> n >> m >> t;

    long z =  64 - __builtin_clzl(t);
    vector d(z+10, vector(n, unordered_set<int>()));

    for (int i=0; i<m; i++) {
        int a, b;
        cin >> a >> b;
        d[0][a].insert(b);
    }


    for (int i=0; i<z; i++) {
        for (int j=0; j<n; j++) {
            for (const auto& v : d[i][j]) {
                for (const auto& u : d[i][v]) d[i+1][j].insert(u);
            }
        }
    }

    unordered_set<int> ans;
    ans.insert(0);
    for (int i=0; i<=z; i++) {
        if (t&1) {
            unordered_set<int> next;
            for (const auto& v : ans) {
                for (const auto& u : d[i][v]) next.insert(u);
            }
            ans = next;
        }
        t>>=1;
    }

    cout << ans.size() << endl;
}
0