結果

問題 No.1861 Required Number
ユーザー 👑 colognecologne
提出日時 2022-03-04 22:40:02
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 471 bytes
コンパイル時間 5,826 ms
コンパイル使用メモリ 132,980 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-26 03:45:44
合計ジャッジ時間 11,253 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 37 ms
4,380 KB
testcase_04 AC 37 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,384 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 3 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 3 ms
4,380 KB
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 29 ms
4,500 KB
testcase_25 AC 58 ms
4,376 KB
testcase_26 AC 35 ms
4,380 KB
testcase_27 AC 53 ms
4,376 KB
testcase_28 AC 44 ms
4,380 KB
testcase_29 AC 57 ms
4,380 KB
testcase_30 AC 58 ms
4,380 KB
testcase_31 AC 57 ms
4,380 KB
testcase_32 AC 57 ms
4,380 KB
testcase_33 AC 57 ms
4,384 KB
testcase_34 AC 57 ms
4,380 KB
testcase_35 AC 61 ms
4,380 KB
testcase_36 AC 56 ms
4,380 KB
testcase_37 AC 62 ms
4,380 KB
testcase_38 AC 56 ms
4,380 KB
testcase_39 AC 56 ms
4,380 KB
testcase_40 AC 62 ms
4,380 KB
testcase_41 AC 58 ms
4,380 KB
testcase_42 AC 62 ms
4,376 KB
testcase_43 AC 59 ms
4,380 KB
testcase_44 WA -
04_evil_1.txt AC 528 ms
4,376 KB
04_evil_2.txt AC 531 ms
4,380 KB
04_evil_3.txt WA -
04_evil_4.txt WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

const int MAXK = 100000;
using Line = bitset<2 * MAXK + 1>;
int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for (int &x : A)
        cin >> x;
    Line ans;
    ans.set(0);
    for (int x : A)
        ans |= ans << x;
    if (!ans[K])
    {
        cout << -1 << endl;
        return 0;
    }
    int ret = 0;
    for (int x : A)
        if (!ans[K + x])
            ++ret;
    cout << ret << endl;
}
0