結果
| 問題 |
No.868 ハイパー部分和問題
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 22:10:27 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 655 bytes |
| コンパイル時間 | 2,438 ms |
| コンパイル使用メモリ | 74,084 KB |
| 実行使用メモリ | 11,040 KB |
| 最終ジャッジ日時 | 2025-04-15 22:11:44 |
| 合計ジャッジ時間 | 11,163 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | AC * 14 TLE * 1 -- * 23 |
ソースコード
#include <iostream>
#include <vector>
#include <bitset>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N, K;
cin >> N >> K;
vector<int> A(N);
for (int i = 0; i < N; ++i) {
cin >> A[i];
}
int Q;
cin >> Q;
while (Q--) {
int x, v;
cin >> x >> v;
x--; // Convert to 0-based index
A[x] = v;
bitset<15001> dp;
dp.set(0); // Initialize with sum 0
for (int a : A) {
if (a == 0 || a > K) continue;
dp |= dp << a;
}
cout << (dp.test(K) ? 1 : 0) << '\n';
}
return 0;
}
lam6er