結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー hanorverhanorver
提出日時 2015-11-12 16:59:09
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 3,884 ms / 5,000 ms
コード長 520 bytes
コンパイル時間 1,541 ms
コンパイル使用メモリ 64,408 KB
実行使用メモリ 5,116 KB
最終ジャッジ日時 2023-09-11 21:26:24
合計ジャッジ時間 26,212 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 4 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 6 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 3,411 ms
5,104 KB
testcase_08 AC 3,538 ms
4,380 KB
testcase_09 AC 2,445 ms
4,376 KB
testcase_10 AC 2,924 ms
4,376 KB
testcase_11 AC 3,729 ms
4,380 KB
testcase_12 AC 10 ms
4,864 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 3,884 ms
4,432 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 948 ms
4,376 KB
testcase_18 AC 3,442 ms
5,116 KB
testcase_19 AC 489 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

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;
	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