結果
| 問題 |
No.1111 コード進行
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-10 21:32:38 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 222 ms / 2,000 ms |
| コード長 | 539 bytes |
| コンパイル時間 | 738 ms |
| コンパイル使用メモリ | 71,984 KB |
| 実行使用メモリ | 215,552 KB |
| 最終ジャッジ日時 | 2024-10-11 08:00:17 |
| 合計ジャッジ時間 | 3,479 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 48 |
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
8 | main()
| ^~~~
ソースコード
#include<iostream>
#include<vector>
using namespace std;
const long mod=1e9+7;
long dp[301][301][301];
int N,M,K;
vector<pair<int,int> >G[301];
main()
{
cin>>N>>M>>K;
for(int i=0;i<M;i++)
{
int u,v,c;cin>>u>>v>>c;
G[u].push_back(make_pair(v,c));
}
for(int i=1;i<=300;i++)dp[1][i][0]=1;
for(int i=1;i<N;i++)for(int j=1;j<=300;j++)for(int k=0;k<=K;k++)
{
for(pair<int,int>e:G[j])if(k+e.second<=K)(dp[i+1][e.first][k+e.second]+=dp[i][j][k])%=mod;
}
long ans=0;
for(int i=1;i<=300;i++)ans+=dp[N][i][K];
cout<<ans%mod<<endl;
}