結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー kyo1
提出日時 2020-07-07 01:38:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 519 bytes
コンパイル時間 2,063 ms
コンパイル使用メモリ 198,028 KB
最終ジャッジ日時 2025-01-11 16:32:39
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<bool> dp(20000, false);
  dp[0] = true;
  for (int i = 0; i < N; i++) {
    vector<bool> dp2 = dp;
    for (int j = 0; j < (int)dp.size(); j++) {
      if (dp[j]) dp2[j ^ A[i]] = true;
    }
    swap(dp, dp2);
  }
  int res = 0;
  for (auto v : dp) {
    if (v) res++;
  }
  cout << res << '\n';
  return 0;
}
0