結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー SSRS
提出日時 2020-11-10 16:32:34
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 398 bytes
コンパイル時間 817 ms
コンパイル使用メモリ 71,320 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-22 17:34:08
合計ジャッジ時間 1,454 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++){
		cin >> A[i];
	}
	vector<bool> dp(32768, false);
	dp[0] = true;
	int ans = 1;
	for (int i = 0; i < N; i++){
		if (!dp[A[i]]){
			for (int j = 0; j < 32768; j++){
				if (dp[j]){
					dp[j ^ A[i]] = true;
				}
			}
			ans *= 2;
		}
	}
	cout << ans << endl;
}
0