結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー moti
提出日時 2015-07-13 04:33:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 375 ms / 5,000 ms
コード長 476 bytes
コンパイル時間 438 ms
コンパイル使用メモリ 56,792 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 02:20:39
合計ジャッジ時間 3,856 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

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