結果
| 問題 |
No.183 たのしい排他的論理和(EASY)
|
| コンテスト | |
| ユーザー |
kyawashell
|
| 提出日時 | 2018-03-29 10:33:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 267 ms / 5,000 ms |
| コード長 | 785 bytes |
| コンパイル時間 | 1,994 ms |
| コンパイル使用メモリ | 190,716 KB |
| 最終ジャッジ日時 | 2025-01-05 09:40:53 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll n;
ll a[10000];
bool dp[2][(1 << 15)];
int main(){
cin >> n;
REP(i,n) {
cin >> a[i];
}
dp[0][0] = true;
FOR(i,1,n + 1) {
REP(j,(1 << 15)) {
dp[1][j] = (dp[0][j] || dp[0][j ^ a[i - 1]]);
}
REP(j,(1 << 15)) {
dp[0][j] = dp[1][j];
}
}
ll ans = 0;
REP(j,(1 << 15)) {
ans += dp[1][j];
}
cout << ans << endl;
return 0;
}
kyawashell