結果
| 問題 |
No.868 ハイパー部分和問題
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 18:50:10 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 722 bytes |
| コンパイル時間 | 1,841 ms |
| コンパイル使用メモリ | 198,036 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-06-12 18:50:28 |
| 合計ジャッジ時間 | 13,992 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | AC * 29 TLE * 1 -- * 8 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int MAX_K = 15000;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N, K;
cin >> N >> K;
vector<int> A(N);
for (int &a : A) cin >> a;
int Q;
cin >> Q;
bitset<MAX_K + 1> dp;
while (Q--) {
int x, v;
cin >> x >> v;
x--; // Convert to 0-based index
A[x] = v;
dp.reset();
dp[0] = true;
bool found = false;
for (int a : A) {
if (a == 0 || a > K) continue;
dp |= dp << a;
if (dp[K]) {
found = true;
break;
}
}
cout << found << '\n';
}
return 0;
}
gew1fw