結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー 158b
提出日時 2015-05-30 10:59:54
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 260 ms / 5,000 ms
コード長 658 bytes
コンパイル時間 469 ms
コンパイル使用メモリ 64,456 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 02:02:57
合計ジャッジ時間 3,102 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <vector>
#include <numeric>
using namespace std;


int main(){
	const int Max = 32768;
	int check[Max] = {0};
	int n;
	int plus;
	int ans;
	
	
	check[0] = 2;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> plus;
		for(int i2=0; i2<Max; i2++){
			if(check[i2] == 2 && check[i2 ^ plus] == 0){
				check[i2 ^ plus] = 1;
			}
		}
		
		//確定
		for(int i2=0; i2<Max; i2++){
			if(check[i2] == 1){
				check[i2] = 2;
			}
		}
	}
	
	//集計
	ans = 0;
	for(int i=0; i<Max; i++){
		if(check[i] == 2){
			ans ++;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}
0