結果

問題 No.183 たのしい排他的論理和(EASY)
コンテスト
ユーザー hanorver
提出日時 2015-11-12 16:59:09
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1,174 ms / 5,000 ms
コード長 520 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 425 ms
コンパイル使用メモリ 84,532 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-18 22:38:07
合計ジャッジ時間 8,665 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<iostream>
#include<vector>
#include<set>

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

	std::set<int> s;
	for (int i = 0; i < switches;i++){
		int num;
		std::cin >> num;
		s.insert(num);
	}

	std::set<int> ans;
	ans.insert(0);
	for (std::set<int>::iterator it = s.begin(); it != s.end(); it++) {
		int num = 0;
		std::set<int>::iterator e = ans.end();
		for (std::set<int>::iterator jt = ans.begin(); jt != e; jt++) {
			ans.insert(*it ^ *jt);
		}
	}

	std::cout << ans.size() << std::endl;
	return 0;
}
0