結果
| 問題 |
No.1861 Required Number
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-04 22:40:02 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 471 bytes |
| コンパイル時間 | 6,054 ms |
| コンパイル使用メモリ | 164,720 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-18 23:07:09 |
| 合計ジャッジ時間 | 10,552 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 WA * 3 |
ソースコード
#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;
}