結果
| 問題 | 
                            No.1340 おーじ君をさがせ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-01-15 22:32:44 | 
| 言語 | C++17(clang)  (17.0.6 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,476 bytes | 
| コンパイル時間 | 1,271 ms | 
| コンパイル使用メモリ | 144,040 KB | 
| 実行使用メモリ | 28,928 KB | 
| 最終ジャッジ日時 | 2024-11-26 19:58:13 | 
| 合計ジャッジ時間 | 4,233 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 57 RE * 2 | 
ソースコード
//
// 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) {
                next.merge(d[i][v]);
            }
            ans = next;
        }
        t>>=1;
    }
    cout << ans.size() << endl;
}