結果
| 問題 |
No.183 たのしい排他的論理和(EASY)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-27 10:21:03 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 620 ms / 5,000 ms |
| コード長 | 674 bytes |
| コンパイル時間 | 2,203 ms |
| コンパイル使用メモリ | 199,684 KB |
| 最終ジャッジ日時 | 2025-02-25 00:46:20 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i)
#define all(a) (a).begin(), (a).end()
int main() {
cin.tie(nullptr);
int N;
cin >> N;
vector<int> A(N);
rep(i, 0, N) cin >> A[i];
vector dp(N, vector<bool>(1 << 15, false));
dp[0][0] = true;
dp[0][A[0]] = true;
rep(i, 0, N - 1) {
rep(j, 0, 1 << 15) {
if (!dp[i][j]) continue;
dp[i + 1][j] = true;
dp[i + 1][j ^ A[i + 1]] = true;
}
}
int ans = 0;
rep(i, 0, 1 << 15) if (dp[N - 1][i]) ans++;
cout << ans << '\n';
}