結果

問題 No.1861 Required Number
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2024-01-04 22:14:25
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 977 bytes
コンパイル時間 8,197 ms
コンパイル使用メモリ 350,808 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-04 22:14:37
合計ジャッジ時間 11,248 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 25 ms
6,676 KB
testcase_04 AC 26 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 3 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 3 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 3 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 3 ms
6,676 KB
testcase_23 AC 2 ms
6,676 KB
testcase_24 AC 19 ms
6,676 KB
testcase_25 AC 36 ms
6,676 KB
testcase_26 AC 22 ms
6,676 KB
testcase_27 AC 34 ms
6,676 KB
testcase_28 AC 28 ms
6,676 KB
testcase_29 AC 35 ms
6,676 KB
testcase_30 AC 37 ms
6,676 KB
testcase_31 AC 35 ms
6,676 KB
testcase_32 AC 34 ms
6,676 KB
testcase_33 AC 35 ms
6,676 KB
testcase_34 AC 35 ms
6,676 KB
testcase_35 AC 38 ms
6,676 KB
testcase_36 AC 36 ms
6,676 KB
testcase_37 AC 39 ms
6,676 KB
testcase_38 AC 36 ms
6,676 KB
testcase_39 AC 36 ms
6,676 KB
testcase_40 AC 39 ms
6,676 KB
testcase_41 AC 37 ms
6,676 KB
testcase_42 AC 39 ms
6,676 KB
testcase_43 AC 37 ms
6,676 KB
testcase_44 WA -
04_evil_1.txt AC 333 ms
6,676 KB
04_evil_2.txt AC 347 ms
6,676 KB
04_evil_3.txt WA -
04_evil_4.txt WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <atcoder/all>


using namespace std;
using namespace atcoder;
#define rep(i,m,n,k) for (int i = (int)(m); i < (int)(n); i += (int)(k))
#define rrep(i,m,n,k) for (int i = (int)(m); i > (int)(n); i += (int)(k))
#define ll long long
#define list(T,A,N) vector<T> A(N);for(int i=0;i<(int)(N);i++){cin >> A[i];}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}

int main(){

    int N,K;
    cin >> N >> K;
    list(int,A,N);
    bitset<200000> x,s;
    int ans = 0;
    x.set(0,1);
    rep(i,0,N,1){
        x |= (x<<A[i]);
    }
    if(!x.test(K)){
        cout << -1 << endl;
        return 0;
    }
    for(auto a:A){
        if (!(x.test(K+a))){
            ans ++;
        }
    }
    cout << ans << endl;
    return 0;
}
0