結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー motimoti
提出日時 2015-07-13 04:33:15
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 326 ms / 5,000 ms
コード長 476 bytes
コンパイル時間 800 ms
コンパイル使用メモリ 57,332 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-11 11:44:40
合計ジャッジ時間 4,299 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>

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 const M = 1<<15;

int N; int A[5001];
bool dp0[M], dp1[M];

int main() {

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

  dp0[0] = 1;
  rep(i, N) {
    rep(j, M) {
      dp1[j] = dp0[j] || dp0[j^A[i]];
    }
    rep(j, M) {
      dp0[j] = dp0[j] || dp1[j];
    }
  }

  int ans = 0;
  rep(i, M) ans += dp0[i];
  cout << ans << endl;

  return 0;
}
0