結果
| 問題 |
No.1876 Xor of Sum
|
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 20:22:37 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 376 ms / 2,000 ms |
| コード長 | 521 bytes |
| コンパイル時間 | 4,514 ms |
| コンパイル使用メモリ | 195,592 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-20 20:24:39 |
| 合計ジャッジ時間 | 10,164 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int MAX_SUM = 2000 * 2000 + 1;
bitset<MAX_SUM> mask;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (auto &a : A) cin >> a;
mask.reset();
mask.set(0); // Initialize with sum 0 (empty subset)
for (auto a : A) {
mask ^= mask << a;
}
mask.set(0, false); // Exclude the empty subset
int res = 0;
for (int i = 0; i < MAX_SUM; ++i) {
if (mask[i]) res ^= i;
}
cout << res << endl;
return 0;
}
lam6er