結果
| 問題 |
No.183 たのしい排他的論理和(EASY)
|
| コンテスト | |
| ユーザー |
Eliza_0x
|
| 提出日時 | 2018-05-13 15:10:39 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 768 bytes |
| コンパイル時間 | 637 ms |
| コンパイル使用メモリ | 67,804 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-28 10:01:36 |
| 合計ジャッジ時間 | 3,132 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 WA * 3 |
ソースコード
#include <iostream>
#include <iomanip>
#include <vector>
#include <bitset>
using namespace std;
int main() {
const int size = 40000;
int n; cin >> n;
vector<int> ns(n);
for (auto &&x: ns) cin >> x;
bitset<size+1> memo;
for (int y = 0; y<(n+1); y++) {
for (int x = 0; x<16384+1; x++) {
if (y==0 && x==0) memo[x] = true;
else if (y==0) memo[x] = false;
else memo[x] = memo[x] || (((x^ns[y-1]) < size) ? memo[x^ns[y-1]] : false);
}
}
// for (int x = 0; x<25; x++) cout << setw(3) << x; cout << endl;
// for (int x = 0; x<25; x++) cout << setw(3) << memo[x]; cout << endl;
int cnt = 0;
for (int x = 0; x<16384+1; x++) cnt += memo[x];
cout << cnt << endl;
}
Eliza_0x