結果

問題 No.1340 おーじ君をさがせ
ユーザー 👑 NachiaNachia
提出日時 2021-01-16 01:07:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 579 bytes
コンパイル時間 523 ms
コンパイル使用メモリ 69,912 KB
実行使用メモリ 6,188 KB
最終ジャッジ日時 2023-08-18 16:50:56
合計ジャッジ時間 6,835 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
5,964 KB
testcase_01 AC 57 ms
5,948 KB
testcase_02 AC 59 ms
6,004 KB
testcase_03 AC 60 ms
5,960 KB
testcase_04 AC 58 ms
6,032 KB
testcase_05 AC 57 ms
5,896 KB
testcase_06 AC 57 ms
6,032 KB
testcase_07 AC 59 ms
5,972 KB
testcase_08 AC 56 ms
6,104 KB
testcase_09 AC 57 ms
6,088 KB
testcase_10 AC 77 ms
5,964 KB
testcase_11 AC 74 ms
6,140 KB
testcase_12 AC 68 ms
5,976 KB
testcase_13 AC 69 ms
5,960 KB
testcase_14 AC 66 ms
6,188 KB
testcase_15 AC 68 ms
5,992 KB
testcase_16 AC 67 ms
5,968 KB
testcase_17 AC 69 ms
6,044 KB
testcase_18 AC 68 ms
5,972 KB
testcase_19 AC 72 ms
5,884 KB
testcase_20 AC 70 ms
5,876 KB
testcase_21 AC 84 ms
5,980 KB
testcase_22 AC 79 ms
5,980 KB
testcase_23 AC 85 ms
5,908 KB
testcase_24 AC 79 ms
6,148 KB
testcase_25 AC 89 ms
5,900 KB
testcase_26 AC 79 ms
5,964 KB
testcase_27 AC 84 ms
5,896 KB
testcase_28 AC 80 ms
6,148 KB
testcase_29 AC 86 ms
5,880 KB
testcase_30 AC 81 ms
5,972 KB
testcase_31 AC 80 ms
5,972 KB
testcase_32 AC 80 ms
6,060 KB
testcase_33 AC 81 ms
5,952 KB
testcase_34 AC 77 ms
5,928 KB
testcase_35 AC 86 ms
6,000 KB
testcase_36 AC 75 ms
5,976 KB
testcase_37 AC 81 ms
5,872 KB
testcase_38 AC 80 ms
5,960 KB
testcase_39 AC 66 ms
5,992 KB
testcase_40 AC 66 ms
6,000 KB
testcase_41 AC 68 ms
5,940 KB
testcase_42 AC 58 ms
6,028 KB
testcase_43 AC 57 ms
6,140 KB
testcase_44 AC 67 ms
5,964 KB
testcase_45 AC 61 ms
5,944 KB
testcase_46 AC 62 ms
6,188 KB
testcase_47 AC 61 ms
5,972 KB
testcase_48 AC 64 ms
5,916 KB
testcase_49 AC 61 ms
6,072 KB
testcase_50 AC 61 ms
5,920 KB
testcase_51 AC 61 ms
5,916 KB
testcase_52 AC 64 ms
6,176 KB
testcase_53 AC 65 ms
6,144 KB
testcase_54 AC 65 ms
5,940 KB
testcase_55 AC 64 ms
5,932 KB
testcase_56 AC 67 ms
5,872 KB
testcase_57 AC 70 ms
5,944 KB
testcase_58 AC 70 ms
5,940 KB
testcase_59 AC 60 ms
6,068 KB
testcase_60 AC 56 ms
5,996 KB
testcase_61 AC 60 ms
6,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)

struct M{ int A[100][100]={}; };

int N,V;
long long T;
M G,P[64],dp,buf;

void mul(const M& l,const M& r,M& dest){
    rep(i,100) rep(j,100){ buf.A[i][j]=0; rep(k,100) buf.A[i][j]|=(l.A[i][k]&r.A[k][j]); }
    dest = buf;
}

int main(){
    cin>>N>>V>>T;
    rep(i,V){ int u,v; cin>>u>>v; G.A[u][v]=1; }
    P[0]=G;
    rep(i,63) mul(P[i],P[i],P[i+1]);
    dp.A[0][0]=1;
    rep(i,60) if(T&(1ll<<i)) mul(dp,P[i],dp);
    int ans=0; rep(i,N) ans+=dp.A[0][i];
    cout<<ans<<endl;
    return 0;
}
0