結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 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 3 ms
5,376 KB
testcase_12 AC 6 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 6 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 69 ms
11,008 KB
testcase_22 AC 177 ms
20,736 KB
testcase_23 AC 69 ms
11,136 KB
testcase_24 AC 302 ms
27,776 KB
testcase_25 AC 10 ms
5,376 KB
testcase_26 AC 8 ms
5,376 KB
testcase_27 AC 6 ms
5,376 KB
testcase_28 AC 15 ms
5,888 KB
testcase_29 AC 3 ms
5,376 KB
testcase_30 AC 75 ms
11,520 KB
testcase_31 AC 323 ms
29,440 KB
testcase_32 AC 5 ms
5,376 KB
testcase_33 AC 5 ms
5,376 KB
testcase_34 AC 41 ms
8,960 KB
testcase_35 AC 45 ms
9,472 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 3 ms
5,376 KB
testcase_38 AC 3 ms
5,376 KB
testcase_39 AC 16 ms
5,376 KB
testcase_40 AC 12 ms
5,376 KB
testcase_41 AC 11 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
testcase_43 AC 2 ms
5,376 KB
testcase_44 AC 2 ms
5,376 KB
testcase_45 AC 1 ms
5,376 KB
testcase_46 AC 18 ms
5,632 KB
testcase_47 AC 21 ms
6,016 KB
testcase_48 AC 23 ms
6,272 KB
testcase_49 AC 9 ms
5,376 KB
testcase_50 AC 15 ms
5,376 KB
testcase_51 AC 15 ms
5,376 KB
testcase_52 AC 3 ms
5,376 KB
testcase_53 AC 3 ms
5,376 KB
testcase_54 AC 3 ms
5,376 KB
testcase_55 AC 24 ms
6,912 KB
testcase_56 AC 2 ms
5,376 KB
testcase_57 AC 1 ms
5,376 KB
testcase_58 AC 2 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+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;
    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/=2;
    }

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