結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー augusuto04augusuto04
提出日時 2015-06-12 06:10:40
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 672 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 59,436 KB
実行使用メモリ 83,384 KB
最終ジャッジ日時 2023-09-20 21:02:13
合計ジャッジ時間 2,788 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 131 ms
74,636 KB
testcase_09 AC 91 ms
52,096 KB
testcase_10 AC 109 ms
62,116 KB
testcase_11 AC 142 ms
80,660 KB
testcase_12 RE -
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 117 ms
83,384 KB
testcase_15 AC 149 ms
83,364 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 33 ms
21,004 KB
testcase_18 WA -
testcase_19 AC 17 ms
11,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
static const int NMAX = 5000;
static const int AMAX = 16384;

int main(){
  int N;
  cin >> N;
  bool memo[N + 1][AMAX + 1];
  int A[N];
  for(int i = 0; i < N; i++)
    cin >> A[i];

  for(int i = 0; i <= N; i++){
    for(int j = 0; j <= AMAX; j++){
      memo[i][j] = false;
    }
  }
  memo[0][0] = 1;

  for(int i = 0; i < N; i++){
    for(int j = 0; j <= AMAX; j++){
      if(memo[i][j]){
        memo[i + 1][(j ^ A[i])] = true;
        memo[i + 1][j] = true;
      }
    }
  }

  int result = 0;
  for(int i = 0; i <= AMAX; i++){
    if(memo[N][i]){
      result++;
    }
  }
  cout << result << endl;
}
0