結果

問題 No.409 ダイエット
ユーザー parukiparuki
提出日時 2016-08-08 15:04:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 983 bytes
コンパイル時間 1,826 ms
コンパイル使用メモリ 166,396 KB
実行使用メモリ 5,760 KB
最終ジャッジ日時 2024-04-24 22:07:11
合計ジャッジ時間 26,377 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 2 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 2 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 7 ms
5,376 KB
testcase_36 AC 9 ms
5,376 KB
testcase_37 AC 9 ms
5,376 KB
testcase_38 AC 8 ms
5,376 KB
testcase_39 AC 8 ms
5,376 KB
testcase_40 AC 8 ms
5,376 KB
testcase_41 AC 9 ms
5,376 KB
testcase_42 AC 9 ms
5,376 KB
testcase_43 AC 8 ms
5,376 KB
testcase_44 AC 7 ms
5,376 KB
testcase_45 AC 9 ms
5,376 KB
testcase_46 AC 9 ms
5,376 KB
testcase_47 AC 9 ms
5,376 KB
testcase_48 AC 9 ms
5,376 KB
testcase_49 AC 9 ms
5,376 KB
testcase_50 AC 9 ms
5,376 KB
testcase_51 AC 9 ms
5,376 KB
testcase_52 AC 8 ms
5,376 KB
testcase_53 AC 9 ms
5,376 KB
testcase_54 AC 8 ms
5,376 KB
testcase_55 AC 405 ms
5,376 KB
testcase_56 WA -
testcase_57 AC 831 ms
5,632 KB
testcase_58 AC 349 ms
5,376 KB
testcase_59 AC 512 ms
5,376 KB
testcase_60 AC 318 ms
5,376 KB
testcase_61 AC 722 ms
5,376 KB
testcase_62 AC 781 ms
5,504 KB
testcase_63 AC 711 ms
5,504 KB
testcase_64 AC 379 ms
5,376 KB
testcase_65 AC 749 ms
5,376 KB
testcase_66 AC 920 ms
5,760 KB
testcase_67 AC 694 ms
5,376 KB
testcase_68 AC 492 ms
5,376 KB
testcase_69 AC 708 ms
5,376 KB
testcase_70 AC 672 ms
5,376 KB
testcase_71 AC 373 ms
5,376 KB
testcase_72 AC 831 ms
5,760 KB
testcase_73 AC 752 ms
5,504 KB
testcase_74 AC 494 ms
5,376 KB
testcase_75 AC 762 ms
5,376 KB
testcase_76 AC 538 ms
5,376 KB
testcase_77 AC 376 ms
5,376 KB
testcase_78 AC 415 ms
5,376 KB
testcase_79 AC 325 ms
5,376 KB
testcase_80 AC 766 ms
5,632 KB
testcase_81 AC 741 ms
5,376 KB
testcase_82 AC 552 ms
5,376 KB
testcase_83 AC 595 ms
5,376 KB
testcase_84 AC 491 ms
5,376 KB
testcase_85 AC 55 ms
5,376 KB
testcase_86 AC 469 ms
5,376 KB
testcase_87 AC 680 ms
5,376 KB
testcase_88 AC 266 ms
5,376 KB
testcase_89 AC 563 ms
5,376 KB
testcase_90 AC 253 ms
5,376 KB
testcase_91 AC 600 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int N;
ll A, B, W, INF = LLONG_MAX;

int main(){
    cin >> N >> A >> B >> W;
    vll D(N), cur(1100, INF), nex(1100, INF);
    rep(i, N)scanf("%lld", &D[i]);
    cur[0] = W;
    
    rep(i, N){
        fill(all(nex), INF);
        rep(j, 1100)if(cur[j] != INF){
            if(j != 1100 - 1)
                smin(nex[j+1], cur[j] - A + B*(j+1));
            smin(nex[0], cur[j] + D[i]);
        }
        swap(cur, nex);
    }
    cout << *min_element(all(cur)) << endl;
}
0