結果
| 問題 |
No.183 たのしい排他的論理和(EASY)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-07-30 20:50:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 147 ms / 5,000 ms |
| コード長 | 675 bytes |
| コンパイル時間 | 572 ms |
| コンパイル使用メモリ | 72,728 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-29 14:12:00 |
| 合計ジャッジ時間 | 2,215 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
#define whole(f,x,...) ([&](decltype((x)) y) { return (f)(begin(y), end(y), ## __VA_ARGS__); })(x)
using namespace std;
const int l = 15;
int main() {
int n; cin >> n;
vector<int> as(n); repeat (i,n) cin >> as[i];
array<bool,(1<<l)> cur = {};
array<bool,(1<<l)> prv = {};
cur[0] = true;
for (int a : as) {
cur.swap(prv);
repeat (i,1<<l) if (prv[i]) {
cur[i ] = true;
cur[i^a] = true;
}
}
int ans = whole(count, cur, true);
cout << ans << endl;
return 0;
}