結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-07-30 21:50:22
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 506 bytes
コンパイル時間 766 ms
コンパイル使用メモリ 69,616 KB
実行使用メモリ 10,788 KB
最終ジャッジ日時 2024-04-24 13:13:46
合計ジャッジ時間 7,370 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 5 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

bool contain(int i, int pos){
	if(i & (1 << pos)) return true;
	else return false;
}

int main(void){
	int n; cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	set<int> s;
	for (int i = 0; i < (1 << n); ++i){
		int x = 0;
		for (int pos = 0; pos < n; ++pos){
			if(contain(i, pos)){
				x ^= a[pos];
			}
		}
		s.insert(x);
	}
	cout << s.size() << endl;
	return 0;
}
0