結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー CleyLCleyL
提出日時 2022-04-14 09:43:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 156 ms / 5,000 ms
コード長 443 bytes
コンパイル時間 722 ms
コンパイル使用メモリ 73,188 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-25 19:38:05
合計ジャッジ時間 2,334 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 156 ms
4,376 KB
testcase_08 AC 85 ms
4,380 KB
testcase_09 AC 59 ms
4,380 KB
testcase_10 AC 70 ms
4,380 KB
testcase_11 AC 92 ms
4,388 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 95 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 22 ms
4,380 KB
testcase_18 AC 123 ms
4,380 KB
testcase_19 AC 12 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int dp[33000];
int main(){
  int n;cin>>n;
  vector<int> A(n);
  for(int i = 0; n > i; i++){
    cin>>A[i];
  }
  dp[0] = 1;
  int mx = 0;
  for(int i = 0; n > i; i++){
    for(int j = 0; mx >= j; j++){
      if(!dp[j])continue;
      dp[j^A[i]] = 1;
      mx = max(mx,j^A[i]);
    }
  }
  int ans = 0;
  for(int i = 0; mx >= i; i++){
    ans += dp[i];
  }
  cout << ans << endl;
  
}
0