結果

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

ソースコード

diff #

#include<iostream>

int main() {
	int switches;
	std::cin >> switches;

	const int max = 1 << 15;
	bool ans[max] = {true};
	for (int i = 0; i < switches; i++) {
		int n;
		std::cin >> n;
		if(!ans[n]){
			for (int j = 0; j < max; j++) {
				if(ans[j]) ans[j ^ n] = true;
			}
		}
	}

	int a = 0;
	for (int i = 0; i < max; i++) {
		a += ans[i];
	}

	std::cout << a << std::endl;
	return 0;
}
0