結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
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 WA -
testcase_14 WA -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  int N;
  cin >> N;
  int memo[N + 1][AMAX + 1], 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] = 0;
    }
  }
  memo[0][0] = 1;

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

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