結果

問題 No.1 道のショートカット
ユーザー BantakoBantako
提出日時 2018-06-07 20:25:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,281 bytes
コンパイル時間 1,805 ms
コンパイル使用メモリ 177,780 KB
実行使用メモリ 93,508 KB
最終ジャッジ日時 2023-09-22 13:19:35
合計ジャッジ時間 3,789 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
4,380 KB
testcase_16 WA -
testcase_17 RE -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 RE -
testcase_43 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef tuple<int,int,int,int> Tp;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,C,V;
    cin >> N >> C >> V;
    vector< Tp > Vec;
    vector<int> S(V*4),T(N),Y(N),M(N);
    rep(i,0,V*4)cin >> S[i];
    rep(i,0,V){
        Vec.emplace_back(S[i], S[i+N], S[i+N*2], S[i+N*3]);
    }
    sort(Vec.begin(), Vec.end());
    int dp[V+1][N+1][C+1];
    rep(i,0,V+1)rep(j,0,N+1)rep(k,0,C+1)dp[i][j][k] = INF;
    dp[0][0][0] = 0;

    /*          
    rep(i,0,V){
        int s = get<0>(Vec[i])-1,t = get<1>(Vec[i])-1,y = get<2>(Vec[i]),m = get<3>(Vec[i]);
        cout << s << " " << t << " " << y << " " << m << endl;
    }
              */


    rep(i,0,V){
        int s = get<0>(Vec[i])-1,t = get<1>(Vec[i])-1,y = get<2>(Vec[i]),m = get<3>(Vec[i]);
        rep(j,0,N+1)rep(k,0,C+1)dp[i+1][j][k] = dp[i][j][k];
        rep(j,0,C+1){
            //dp[i+1][t][j] = min(dp[i][t][j], dp[i+1][t][j]);
            if(j + y <= C){
                dp[i+1][t][j+y] = min(dp[i][t][j+y], dp[i][s][j] + m);
            }
        }
    }
    int mini = INF;
    rep(i,0,C+1)mini = min(mini, dp[V][N-1][i]);
    if(mini == INF)mini = -1;
    cout << mini << endl;
}
0