結果
| 問題 |
No.1111 コード進行
|
| コンテスト | |
| ユーザー |
auaua
|
| 提出日時 | 2020-07-10 22:17:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,082 bytes |
| コンパイル時間 | 1,940 ms |
| コンパイル使用メモリ | 176,708 KB |
| 実行使用メモリ | 219,904 KB |
| 最終ジャッジ日時 | 2024-10-11 09:34:50 |
| 合計ジャッジ時間 | 5,107 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 WA * 16 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
signed main(){
ll n,m,k;cin>>n>>m>>k;
vector<vector<vector<ll> > >dp(n+1,vector<vector<ll> >(301,vector<ll>(k+1)));
rep(i,n){
dp[0][i][0]=1;
}
vector<pair<pll,ll> >a(m);
rep(i,m){
ll p,q,c;cin>>p>>q>>c;
p--;
q--;
a[i]=mp(mp(p,q),c);
}
rep(i,n-1){
rep(j,k+1){
rep(l,m){
ll p=a[l].first.first;
ll q=a[l].first.second;
ll c=a[l].second;
if(j+c>k)continue;
dp[i+1][q][j+c]=(dp[i+1][q][j+c]+dp[i][p][j])%inf;
}
}
}
ll ans=0;
rep(i,n){
ans=(ans+dp[n-1][i][k])%inf;
}
cout<<ans<<endl;
}
auaua