結果

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

set<int> dp;
bool e[33000];

int n;
int main() {
  cin >> n;

  dp.insert(0);
  e[0] = true;
  for(int i = 0; i < n; i++) {
    int a;
    cin >> a;
    for(auto itr = dp.begin(); itr != dp.end(); ++itr) {
      if(!e[(*itr) ^ a]) {
	e[(*itr) ^ a] = true;
      dp.insert((*itr) ^ a);
      }
    }
  }
  cout << dp.size() << endl;
}
    
 
0