結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー beetbeet
提出日時 2018-08-09 14:31:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 324 ms / 5,000 ms
コード長 473 bytes
コンパイル時間 2,420 ms
コンパイル使用メモリ 168,204 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 19:02:48
合計ジャッジ時間 4,533 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,376 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 228 ms
4,380 KB
testcase_08 AC 228 ms
4,376 KB
testcase_09 AC 159 ms
4,376 KB
testcase_10 AC 192 ms
4,376 KB
testcase_11 AC 248 ms
4,380 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 324 ms
4,376 KB
testcase_15 AC 258 ms
4,376 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 59 ms
4,376 KB
testcase_18 AC 223 ms
4,380 KB
testcase_19 AC 30 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  const Int MAX = 1<<15;
  vector<Int> dp(MAX,0);
  dp[0]=1;
  for(Int i=0;i<n;i++){
    vector<Int> nx(MAX,0);
    for(Int j=0;j<MAX;j++){
      nx[j]|=dp[j];
      nx[j^a[i]]|=dp[j];
    }
    swap(dp,nx);
  }
  Int ans=0;
  for(Int i=0;i<MAX;i++) ans+=!!dp[i];
  cout<<ans<<endl;
  return 0;
}
0