結果
問題 |
No.1876 Xor of Sum
|
ユーザー |
|
提出日時 | 2022-04-27 14:47:19 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 379 ms / 2,000 ms |
コード長 | 686 bytes |
コンパイル時間 | 3,271 ms |
コンパイル使用メモリ | 245,444 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 07:45:13 |
合計ジャッジ時間 | 11,434 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define ll long long #define all(x) x.begin(),x.end() #define ar array #define sz(x) ((int)x.size()) template <class T,class S> inline bool chmin(T &a,const S &b) {return (a> b? a= b, 1: 0);} template <class T,class S> inline bool chmax(T &a,const S &b) {return (a< b? a= b, 1: 0);} const int mxN = 2000 * 2000 + 5; int main(){ ios_base::sync_with_stdio(false),cin.tie(0); int n; cin >> n; bitset <mxN> dp; dp[0] = 1; for(int i = 0, a;i < n;i++){ cin >> a; dp ^= (dp << a); } int ans = 0; for(int i = 1;i <= mxN;i++) if(dp[i]) ans ^= i; cout << ans << "\n"; return 0; }