結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー 37kt_37kt_
提出日時 2016-04-06 07:52:03
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 258 ms / 5,000 ms
コード長 388 bytes
コンパイル時間 1,587 ms
コンパイル使用メモリ 144,348 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 00:17:46
合計ジャッジ時間 4,212 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 187 ms
4,376 KB
testcase_08 AC 188 ms
4,380 KB
testcase_09 AC 129 ms
4,380 KB
testcase_10 AC 155 ms
4,380 KB
testcase_11 AC 204 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 258 ms
4,380 KB
testcase_15 AC 211 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 48 ms
4,380 KB
testcase_18 AC 182 ms
4,376 KB
testcase_19 AC 24 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

bool dp[2][1 << 15];

int main(){
  auto src = dp[0], dst = dp[1];
  dp[0][0] = true;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++){
    int a;
    cin >> a;
    for (int j = 0; j < (1 << 15); j++){
      dst[j] |= src[j];
      dst[j ^ a] |= src[j];
    }
    swap(src, dst);
  }
  cout << count(src, src + (1 << 15), true) << endl;
}
0