結果
| 問題 |
No.183 たのしい排他的論理和(EASY)
|
| コンテスト | |
| ユーザー |
d_nishiyama85
|
| 提出日時 | 2016-07-09 20:59:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 238 ms / 5,000 ms |
| コード長 | 739 bytes |
| コンパイル時間 | 466 ms |
| コンパイル使用メモリ | 59,012 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-29 14:06:19 |
| 合計ジャッジ時間 | 2,947 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include <vector>
#include <iostream>
using namespace std;
#define MAX (1<<15)
bool now[MAX];
bool nex[MAX];
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++)
{
cin >> A[i];
}
int ans = 0;
now[0] = true;
for (int i = 0; i < N; i++)
{
for (int j = 0; j < MAX; j++)
{
if (now[j]) {
int num = j ^ A[i];
nex[num] = true;
}
nex[j] |= now[j];
}
for (int j = 0; j < MAX; j++)
{
now[j] |= nex[j];
}
}
for (int i = 0; i < MAX; i++)
{
if (now[i]) ans++;
}
cout << ans << endl;
//cout << (1ll << ans) << endl;
}
d_nishiyama85