結果

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
using namespace std;



int main() {

	int n;
	int q[6000];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> q[i];
	}
	
	bool dp[33000] = { 0 };
	dp[0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 33000; j++) {
			if (dp[j] == 1) {
				int y = j^q[i];
				dp[y] = 1;
			
			
			}
		
		}
	
	}

	int ans = 0;
	for (int i = 0; i < 33000; i++) {
		if (dp[i] == 1) ans++;
	}


	cout << ans << endl;
	return 0;
}
0