結果
| 問題 |
No.183 たのしい排他的論理和(EASY)
|
| コンテスト | |
| ユーザー |
IL_msta
|
| 提出日時 | 2015-06-19 19:31:49 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 119 ms / 5,000 ms |
| コード長 | 1,050 bytes |
| コンパイル時間 | 1,166 ms |
| コンパイル使用メモリ | 83,968 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-29 02:05:20 |
| 合計ジャッジ時間 | 2,080 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <list>
#include <queue>
#include <vector>
#include <complex>
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) std::cout<<(p)<<std::endl;
/////////
typedef long long LL;
typedef long double LD;
/////////
using namespace::std;
/////////
const int dpMax = 16384*2;
bool dp1[dpMax];
bool dp2[dpMax];
int main(void){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cout << std::fixed;//
//cout << setprecision(6);//
int N;
cin>>N;
int A[5000];
rep(i,N)cin>>A[i];
sort(A,A+N);
rep(i,dpMax){
dp1[i] = false;
dp2[i] = false;
}
dp1[0] = true;
dp2[0] = true;
for(int m=0;m<N;++m){
for(int i = dpMax-1;i>=0;--i){
if(dp1[i] == true){
dp2[ i^A[m] ] = true;
}
}
for(int i=0;i<dpMax;++i){
dp1[i] = dp2[i];//ha-
}
}
int ans=0;
for(int i=0;i<dpMax;++i){
if(dp1[i] == true){
++ans;
}
}
P(ans);
return 0;
}
IL_msta