結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー Nzt3Nzt3
提出日時 2022-09-27 17:38:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 584 bytes
コンパイル時間 1,968 ms
コンパイル使用メモリ 203,312 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-24 03:57:02
合計ジャッジ時間 3,321 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 4 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 3 ms
4,380 KB
testcase_12 AC 7 ms
4,376 KB
testcase_13 AC 1 ms
4,500 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 5 ms
4,380 KB
testcase_18 AC 6 ms
4,376 KB
testcase_19 AC 5 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 3 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 4 ms
4,380 KB
testcase_29 AC 4 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N,M,T;
  cin>>N>>M>>T;
  vector<vector<int>>G(N);
  for(int i=0;i<M;i++){
    int u,v;
    cin>>u>>v;
    G[u].push_back(v),
    G[v].push_back(u);
  }
  vector<unsigned>cnt1(N),cnt2(N);
  cnt1[0]=1;
  for(int i=0;i<T;i++){
    for(int j=0;j<N;j++){
      for(int k:G[j]){
        cnt2[k]=min(cnt2[k]+cnt1[j],cnt2[k]+cnt1[j]-mod);
      }
    }
    for(int j=0;j<N;j++){
      cnt1[j]=cnt2[j];
      cnt2[j]=0;
    }
  }
  cout<<cnt1[0]<<'\n';
}
0