結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー nCk_cvnCk_cv
提出日時 2015-12-10 18:53:41
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 524 ms / 5,000 ms
コード長 606 bytes
コンパイル時間 1,870 ms
コンパイル使用メモリ 70,476 KB
実行使用メモリ 323,704 KB
最終ジャッジ日時 2023-09-11 22:44:20
合計ジャッジ時間 6,691 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 4 ms
4,388 KB
testcase_03 AC 3 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 4 ms
4,384 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 444 ms
287,072 KB
testcase_08 AC 421 ms
288,112 KB
testcase_09 AC 287 ms
199,892 KB
testcase_10 AC 349 ms
238,432 KB
testcase_11 AC 458 ms
312,356 KB
testcase_12 AC 3 ms
4,384 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 524 ms
323,572 KB
testcase_15 AC 472 ms
323,704 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 108 ms
74,968 KB
testcase_18 AC 422 ms
280,564 KB
testcase_19 AC 53 ms
38,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
using namespace std;
#define ll long long

bool dp[5001][65536];

int main() {
  int N;
  cin >> N;
  int a[N];
  for(int i = 0; i < N; i++) {
    cin >> a[i];
  }
  dp[0][0] = true;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < 65536; j++) {
      dp[i+1][j] |= dp[i][j];
      if(!dp[i][j]) continue;
      dp[i+1][j ^ a[i]] = true;
    }
  }
  int ans = 0;
  for(int i = 0; i < 65536; i++) {
    if(dp[N][i]) ans++;
  }
  cout << ans << endl;




}
0