結果
| 問題 |
No.183 たのしい排他的論理和(EASY)
|
| ユーザー |
sei0o
|
| 提出日時 | 2017-10-17 11:10:43 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 792 bytes |
| コンパイル時間 | 628 ms |
| コンパイル使用メモリ | 82,144 KB |
| 実行使用メモリ | 84,096 KB |
| 最終ジャッジ日時 | 2024-11-17 21:45:54 |
| 合計ジャッジ時間 | 2,280 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 WA * 3 |
ソースコード
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
bool dp[5010][16500]; // dp[i][k] = a[0] ~ a[i] までで k が作れるか
int main() {
int N;
cin >> N;
ll a[N];
for (int i = 0; i < N; i++) {
cin >> a[i];
}
dp[0][0] = true;
for (int i = 0; i < N; i++) {
for (int k = 0; k < 16500; k++) {
if (dp[i][k]) {
if ((k^a[i]) < 16400) dp[i+1][k ^ a[i]] = true;
dp[i+1][k] = true;
}
}
}
int ans = 0;
for (int i = 0; i < 16500; i++) {
if (dp[N][i]) ans++;
}
cout << ans << endl;
return 0;
}
sei0o