結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー motimoti
提出日時 2015-07-13 04:20:43
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 524 bytes
コンパイル時間 524 ms
コンパイル使用メモリ 61,448 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-22 14:51:03
合計ジャッジ時間 4,282 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <set>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)

int N; int A[5001]; bool dp[2][1<<15];

int main() {

  cin >> N; rep(i, N) cin >> A[i];

  dp[0][0] = 1;
  rep(i, N) {
    rep(j, 1<<15) {
      dp[(i+1)&1][j] = dp[(i+1)&1][j] || dp[i][j^A[i]];
    }
    rep(j, 1<<15) {
      dp[(i+1)&1][j] = dp[(i+1)&1][j] || dp[i][j];
    }
  }

  int ans = 0;
  rep(i, 1<<15) ans += dp[N&1][i];
  cout << ans << endl;

  return 0;
}
0