結果

問題 No.617 Nafmo、買い出しに行く
ユーザー chocopuuchocopuu
提出日時 2019-01-21 23:27:53
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 323 bytes
コンパイル時間 1,452 ms
コンパイル使用メモリ 163,900 KB
実行使用メモリ 11,396 KB
最終ジャッジ日時 2023-10-13 17:29:51
合計ジャッジ時間 3,590 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
11,344 KB
testcase_01 AC 11 ms
11,176 KB
testcase_02 AC 27 ms
11,260 KB
testcase_03 AC 39 ms
11,396 KB
testcase_04 AC 17 ms
11,236 KB
testcase_05 AC 41 ms
11,256 KB
testcase_06 AC 48 ms
11,184 KB
testcase_07 AC 46 ms
11,140 KB
testcase_08 AC 6 ms
11,132 KB
testcase_09 RE -
testcase_10 AC 47 ms
11,140 KB
testcase_11 AC 50 ms
11,308 KB
testcase_12 AC 46 ms
11,140 KB
testcase_13 AC 46 ms
11,184 KB
testcase_14 AC 47 ms
11,140 KB
testcase_15 AC 47 ms
11,140 KB
testcase_16 AC 45 ms
11,192 KB
testcase_17 AC 47 ms
11,236 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 9 ms
11,196 KB
testcase_21 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
    int N,K,x;
    cin>>N>>K;
    int dp[2000200]={};
    dp[0]=1;
    while(N--){
        cin>>x;
        for(int j = 2000210-x; j >= 0; --j)if(dp[j]!=0)dp[j+x]=1;
    }
    for(int i = K ; i >= 0 ; i--)if(dp[i]){
        cout<<i<<"\n";
        return 0;
    }
}
0