結果
問題 | No.1749 ラムドスウイルスの感染拡大 |
ユーザー |
|
提出日時 | 2022-09-27 17:38:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 584 bytes |
コンパイル時間 | 2,031 ms |
コンパイル使用メモリ | 197,096 KB |
最終ジャッジ日時 | 2025-02-07 17:21:04 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
#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'; }