結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー legosuke
提出日時 2017-12-30 23:08:18
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 189 ms / 5,000 ms
コード長 406 bytes
コンパイル時間 1,585 ms
コンパイル使用メモリ 158,564 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 03:32:52
合計ジャッジ時間 3,639 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int n;
int a[5010];
bool dp[1 << 15];

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  dp[0] = true;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 1 << 15; j++) {
      dp[j ^ a[i]] |= dp[j];
    }
  }

  int ans = 0;
  for (int i = 0; i < 1 << 15; i++) {
    ans += dp[i];
  }
  cout << ans << endl;

  return 0;
}
0