結果

問題 No.1749 ラムドスウイルスの感染拡大
ユーザー kotatsugame
提出日時 2021-11-19 23:42:35
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 677 ms
コンパイル使用メモリ 60,356 KB
実行使用メモリ 11,424 KB
最終ジャッジ日時 2025-01-01 23:29:09
合計ジャッジ時間 1,802 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
const long mod=998244353;
int N,M,T;
int U[1000],V[1000];
long dp[1001][1000];
main()
{
	cin>>N>>M>>T;
	for(int i=0;i<M;i++)
	{
		cin>>U[i]>>V[i];
	}
	dp[0][0]=1;
	for(int t=0;t<T;t++)
	{
		for(int i=0;i<M;i++)
		{
			dp[t+1][U[i]]+=dp[t][V[i]];
			dp[t+1][V[i]]+=dp[t][U[i]];
		}
		for(int i=0;i<N;i++)dp[t+1][i]%=mod;
	}
	cout<<dp[T][0]<<endl;
}
0