結果

問題 No.1111 コード進行
ユーザー KKT89KKT89
提出日時 2020-07-11 17:17:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 907 bytes
コンパイル時間 1,130 ms
コンパイル使用メモリ 112,448 KB
実行使用メモリ 109,440 KB
最終ジャッジ日時 2024-04-21 07:34:12
合計ジャッジ時間 3,409 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
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 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 3 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 4 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 4 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 2 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 3 ms
5,376 KB
testcase_25 AC 6 ms
5,888 KB
testcase_26 AC 3 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 5 ms
6,144 KB
testcase_29 AC 15 ms
14,592 KB
testcase_30 AC 16 ms
11,136 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 26 ms
16,128 KB
testcase_33 AC 23 ms
10,240 KB
testcase_34 AC 5 ms
5,632 KB
testcase_35 AC 8 ms
8,192 KB
testcase_36 AC 94 ms
62,592 KB
testcase_37 AC 67 ms
57,088 KB
testcase_38 AC 39 ms
33,152 KB
testcase_39 AC 42 ms
19,968 KB
testcase_40 AC 84 ms
60,160 KB
testcase_41 AC 23 ms
21,248 KB
testcase_42 AC 74 ms
60,800 KB
testcase_43 AC 50 ms
35,840 KB
testcase_44 AC 27 ms
25,472 KB
testcase_45 AC 43 ms
37,760 KB
testcase_46 AC 11 ms
11,392 KB
testcase_47 AC 94 ms
11,520 KB
testcase_48 AC 111 ms
109,440 KB
testcase_49 AC 102 ms
102,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
using namespace std;
typedef long long int ll;
using ull = unsigned long long;

constexpr ll mod=1e9+7;

int dp[301][301][301];

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m,k; cin >> n >> m >> k;
    vector<int> p(m),q(m),c(m);
    for(int i=0;i<m;i++){
        cin >> p[i] >> q[i] >> c[i];
        p[i]--; q[i]--;
        dp[2][q[i]][c[i]]++;
    }
    for(int i=2;i<n;i++){
        for(int j=0;j<m;j++){
            for(int l=0;l<=k;l++){
                if(l+c[j]<=k)(dp[i+1][q[j]][l+c[j]]+=dp[i][p[j]][l])%=mod;
            }
        }
    }
    int res=0;
    for(int i=0;i<=300;i++){
        (res+=dp[n][i][k])%=mod;
    }
    cout << res << endl;
}
0