結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー hanorver
提出日時 2015-11-12 18:17:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 509 bytes
コンパイル時間 588 ms
コンパイル使用メモリ 66,592 KB
実行使用メモリ 11,680 KB
最終ジャッジ日時 2024-09-13 14:30:01
合計ジャッジ時間 7,146 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 = s;
	ans.insert(0);
	for (std::set<int>::iterator it = s.begin(); it != s.end(); ++it) {
		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