結果
問題 |
No.183 たのしい排他的論理和(EASY)
|
ユーザー |
![]() |
提出日時 | 2019-08-02 22:16:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 181 ms / 5,000 ms |
コード長 | 493 bytes |
コンパイル時間 | 3,024 ms |
コンパイル使用メモリ | 73,044 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-02 15:46:27 |
合計ジャッジ時間 | 2,794 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { const int MAX = (1 << 14) * 2; int n; cin >> n; vector<int> a(n); for (int &ai: a) cin >> ai; vector<int> cur(MAX, 0), nxt(MAX, 0); cur[0] = 1; for (int ai: a) { for (int i = 0; i < MAX; i++) nxt[i] = cur[i ^ ai] | cur[i]; swap(cur, nxt); } int ans = 0; for (int i = 0; i < MAX; i++) if (cur[i]) ans++; cout << ans << endl; return 0; }