結果

問題 No.617 Nafmo、買い出しに行く
ユーザー chocopuuchocopuu
提出日時 2019-01-21 23:26:19
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 323 bytes
コンパイル時間 1,460 ms
コンパイル使用メモリ 163,020 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-13 17:29:47
合計ジャッジ時間 4,181 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 3 ms
4,352 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 3 ms
4,348 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,352 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 7 ms
4,348 KB
testcase_16 AC 6 ms
4,348 KB
testcase_17 AC 7 ms
4,352 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 3 ms
4,348 KB
testcase_20 AC 3 ms
4,352 KB
testcase_21 AC 3 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
    int N,K,x;
    cin>>N>>K;
    int dp[200020]={};
    dp[0]=1;
    while(N--){
        cin>>x;
        for(int j = 200020-x-1; 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