結果

問題 No.1340 おーじ君をさがせ
ユーザー 👑 zeronosu77108zeronosu77108
提出日時 2021-01-15 22:43:54
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 331 ms / 2,000 ms
コード長 1,495 bytes
コンパイル時間 3,053 ms
コンパイル使用メモリ 107,500 KB
実行使用メモリ 28,996 KB
最終ジャッジ日時 2023-08-18 16:42:20
合計ジャッジ時間 6,240 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 6 ms
4,424 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 6 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 69 ms
11,008 KB
testcase_22 AC 177 ms
20,420 KB
testcase_23 AC 71 ms
11,148 KB
testcase_24 AC 312 ms
27,372 KB
testcase_25 AC 10 ms
5,004 KB
testcase_26 AC 9 ms
4,688 KB
testcase_27 AC 6 ms
4,408 KB
testcase_28 AC 15 ms
5,844 KB
testcase_29 AC 3 ms
4,376 KB
testcase_30 AC 75 ms
11,540 KB
testcase_31 AC 331 ms
28,996 KB
testcase_32 AC 5 ms
4,656 KB
testcase_33 AC 5 ms
4,544 KB
testcase_34 AC 42 ms
9,060 KB
testcase_35 AC 45 ms
9,392 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 3 ms
4,376 KB
testcase_38 AC 4 ms
4,380 KB
testcase_39 AC 11 ms
4,844 KB
testcase_40 AC 7 ms
4,460 KB
testcase_41 AC 7 ms
4,464 KB
testcase_42 AC 1 ms
4,376 KB
testcase_43 AC 2 ms
4,376 KB
testcase_44 AC 2 ms
4,380 KB
testcase_45 AC 2 ms
4,376 KB
testcase_46 AC 16 ms
5,448 KB
testcase_47 AC 19 ms
5,712 KB
testcase_48 AC 22 ms
6,044 KB
testcase_49 AC 5 ms
4,464 KB
testcase_50 AC 9 ms
4,772 KB
testcase_51 AC 10 ms
4,772 KB
testcase_52 AC 3 ms
4,376 KB
testcase_53 AC 2 ms
4,376 KB
testcase_54 AC 3 ms
4,380 KB
testcase_55 AC 24 ms
6,760 KB
testcase_56 AC 2 ms
4,380 KB
testcase_57 AC 2 ms
4,376 KB
testcase_58 AC 2 ms
4,376 KB
testcase_59 AC 2 ms
4,380 KB
testcase_60 AC 1 ms
4,376 KB
testcase_61 AC 2 ms
4,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+10, 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 = {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);
            }
            swap(ans, next);
        }
        t/=2;
    }

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