結果

問題 No.1340 おーじ君をさがせ
ユーザー HaaHaa
提出日時 2021-01-15 22:06:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,428 bytes
コンパイル時間 1,883 ms
コンパイル使用メモリ 182,536 KB
実行使用メモリ 38,192 KB
最終ジャッジ日時 2023-08-17 19:47:18
合計ジャッジ時間 6,772 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
11,232 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 5 ms
4,380 KB
testcase_03 AC 5 ms
4,380 KB
testcase_04 AC 24 ms
6,112 KB
testcase_05 AC 5 ms
4,380 KB
testcase_06 AC 23 ms
6,180 KB
testcase_07 AC 11 ms
4,672 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 165 ms
10,348 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 313 ms
25,508 KB
testcase_13 AC 4 ms
4,376 KB
testcase_14 AC 6 ms
4,464 KB
testcase_15 AC 6 ms
4,488 KB
testcase_16 AC 161 ms
18,136 KB
testcase_17 AC 4 ms
4,380 KB
testcase_18 AC 5 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 101 ms
12,316 KB
testcase_21 TLE -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=1000000007;
constexpr ll INF=1e18;

VVI edge(110,VI(0));

int main(){
    int n, m; cin >> n >> m;
    ll t; cin >> t;
    int a, b;
    bool f[110][110]={0};
    REP(i,m){
        cin >> a >> b;
        f[a][b]=1;
    }
    REP(i,n)REP(j,n){
        if(f[i][j])
            edge[i].push_back(j);
    }
    queue<P> q;
    q.push({0,0});
    map<P,bool> mp;
    mp[{0,0}]=1;
    while(!q.empty()){
        P p=q.front();
        if(p.second>=11000)
            break;
        q.pop();
        for(auto to:edge[p.first]){
            if(!mp[{to,p.second+1}]){
                mp[{to,p.second+1}]=1;
                q.push({to,p.second+1});
            }
        }
    }
    if(t<11000){
        int ans=0;
        REP(i,n) ans+=mp[{i,t}];
        cout << ans << endl;
    }
    else{
        int ans=0;
        REP(i,n){
            int x=-1;
            for(int j=10000;j<10200;j++){
                if(mp[{i,j}]){
                    if(x!=-1){
                        if(t%(j-x)==x%(j-x))
                            ans++;
                        break;
                    }
                    x=j;
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}
0