結果
| 問題 |
No.1111 コード進行
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2020-07-10 23:12:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 832 bytes |
| コンパイル時間 | 1,938 ms |
| コンパイル使用メモリ | 196,672 KB |
| 最終ジャッジ日時 | 2025-01-11 19:12:21 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 46 WA * 2 |
ソースコード
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
const ll MOD=1e9+7;
int main(){
ll n,m,K;
cin>>n>>m>>K;
ll dp[n+1][301][K+1];
rep(i,n+1){
rep(j,301){
rep(k,K+1) dp[i][j][k]=0;
}
}
vector<pair<ll,ll>> A[301];
ll p,q,c;
rep(i,m){
cin>>p>>q>>c;
A[p].push_back({q,c});
dp[2][q][c]++;
}
for(int i=2;i<=n-1;i++){
for(int j=1;j<=300;j++){
for(int k=0;k<=K;k++){
for(auto x:A[j]){
if(k+x.second>K) continue;
dp[i+1][x.first][k+x.second]=(dp[i+1][x.first][k+x.second]+dp[i][j][k])%MOD;
}
}
}
}
ll ans=0;
for(int j=1;j<=300;j++){
ans=(ans+dp[n][j][K])%MOD;
}
cout<<ans<<endl;
return 0;
}
umezo