結果
問題 | No.1111 コード進行 |
ユーザー |
![]() |
提出日時 | 2023-04-07 08:07:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,404 bytes |
コンパイル時間 | 4,634 ms |
コンパイル使用メモリ | 260,076 KB |
最終ジャッジ日時 | 2025-02-11 23:34:28 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 RE * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; //using mint = static_modint<998244353>; //using mint = modint; using mint = static_modint<1000000007>; using vm = vector<mint>; using vvm = vector<vm>; using vvvm = vector<vvm>; ostream &operator<<(ostream &o,const mint &m){cout<<m.val();return o;} using ll = long long; using vl = vector<ll>; using vvl = vector<vl>; using pl = pair<ll,ll>; #define rep(i,n) for(ll i=0;i<(ll)(n);++i) #define reps(i,s,n) for(ll i=(s);i<(ll)(n);++i) #define rep1(i,n) for(ll i=1;i<=(ll)(n);++i) #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) const long long INF = 1e18; #ifdef DEBUG #include <debug.hpp> #endif int main(){ #ifdef DEBUG cout << "--- Input ---" << endl; #endif ll N,M,K;cin>>N>>M>>K; vector<vector<pl>> E(301); rep(i,M){ ll a,b,c;cin>>a>>b>>c; //E.at(a).at(i)=make_pair(b,c); E.at(a).push_back({b,c}); } reps(i,1,301)E.at(0).push_back({i,0}); #ifdef DEBUG cout << "--- Logic ---" << endl; #endif vvvm dp(N+1,vvm(K*2+1,vm(301))); dp.at(0).at(0).at(0)=1; rep(i,N)rep(k,K+1)rep(lst,301){ for(auto &p:E.at(lst)){ dp.at(i+1).at(k+p.second).at(p.first) +=dp.at(i).at(k).at(lst); } } #ifdef DEBUG cout<<dp; cout << "--- Answer ---" << endl; #endif mint ans=0; reps(lst,1,301)ans+=dp.at(N).at(K).at(lst); cout<<ans<<endl; return 0; } //cout << fixed << setprecision(9);