結果
| 問題 |
No.1876 Xor of Sum
|
| ユーザー |
|
| 提出日時 | 2022-03-12 19:03:19 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 399 ms / 2,000 ms |
| コード長 | 1,354 bytes |
| コンパイル時間 | 952 ms |
| コンパイル使用メモリ | 104,164 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-17 03:05:44 |
| 合計ジャッジ時間 | 9,604 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
constexpr int LIM = 4'000'010;
bitset<LIM> bs;
int N;
vector<int> A;
int main() {
for (; ~scanf("%d", &N); ) {
A.resize(N);
for (int i = 0; i < N; ++i) {
scanf("%d", &A[i]);
}
bs.reset();
bs[0] = 1;
for (int i = 0; i < N; ++i) {
bs ^= bs << A[i];
}
int ans = 0;
for (int x = 1; x < LIM; ++x) if (bs[x]) {
ans ^= x;
}
printf("%d\n", ans);
}
return 0;
}