結果

問題 No.1111 コード進行
ユーザー chocoruskchocorusk
提出日時 2020-07-10 21:36:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,408 bytes
コンパイル時間 1,413 ms
コンパイル使用メモリ 131,580 KB
実行使用メモリ 216,448 KB
最終ジャッジ日時 2024-04-19 16:08:02
合計ジャッジ時間 2,947 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 2 ms
5,376 KB
testcase_14 WA -
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 4 ms
5,760 KB
testcase_26 WA -
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 3 ms
5,376 KB
testcase_29 AC 9 ms
9,088 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 4 ms
5,376 KB
testcase_35 AC 3 ms
5,376 KB
testcase_36 AC 13 ms
9,728 KB
testcase_37 AC 21 ms
21,376 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 3 ms
5,376 KB
testcase_42 AC 36 ms
36,736 KB
testcase_43 WA -
testcase_44 AC 3 ms
5,376 KB
testcase_45 AC 3 ms
5,376 KB
testcase_46 WA -
testcase_47 AC 18 ms
18,176 KB
testcase_48 AC 202 ms
216,448 KB
testcase_49 AC 4 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
ll dp[303][303][303];
int main()
{
    int n, m, k; cin>>n>>m>>k;
    int p[303], q[303], c[303];
    vector<P> g[303];
    for(int i=0; i<m; i++){
        cin>>p[i]>>q[i]>>c[i];
        p[i]--; q[i]--;
        g[p[i]].push_back({q[i], c[i]});
        dp[1][q[i]][c[i]]=1;
    }
    for(int i=1; i<n-1; i++){
        for(int j=0; j<300; j++){
            if(g[j].empty()) continue;
            for(int l=0; l<=k; l++){
                if(dp[i][j][l]==0) continue;
                for(auto q:g[j]){
                    int y=q.first;
                    if(l+q.second<=k){
                        (dp[i+1][y][l+q.second]+=dp[i][j][l])%=MOD;
                    }
                }
            }
        }
    }
    ll ans=0;
    for(int i=0; i<300; i++){
        (ans+=dp[n-1][i][k])%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}
0