結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー huka_hukahuka_huka
提出日時 2021-09-24 19:01:40
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 495 ms / 5,000 ms
コード長 868 bytes
コンパイル時間 1,133 ms
コンパイル使用メモリ 147,996 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-18 20:18:21
合計ジャッジ時間 5,675 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 439 ms
4,376 KB
testcase_08 AC 441 ms
4,376 KB
testcase_09 AC 302 ms
4,376 KB
testcase_10 AC 365 ms
4,380 KB
testcase_11 AC 477 ms
4,376 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 489 ms
4,376 KB
testcase_15 AC 495 ms
4,380 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 110 ms
4,380 KB
testcase_18 AC 429 ms
4,376 KB
testcase_19 AC 55 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# ifndef ONLINE_JUDGE
# define _GLIBCXX_DEBUG
# endif
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;
# define rep(i, n) for(int i = 0; i < (int)(n); i++)
# define all(v) v.begin(), v.end()

int main(){
  constexpr char endl = '\n';
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(10);
  //input();
  int N;cin >> N;
  vi A(N);
  for(auto &&e : A)  cin >> e;
  //solve();
  vector<bool> dp(pow(2, 15), false);
  //dp[i]:=iを作れるか
  //元:dp[i][k]:=i番目まで見たときkを作れるか
  dp[0] = true;
  rep(i, N){
    dp[A[i]] = true;
  }
  for(int &a : A){
    rep(i, pow(2, 15)){
      dp[i^a] = dp[i^a] | dp[i];
    }
  }
  //output();
  int cnt = 0;
  for(bool &&e : dp)  if(e)  ++cnt;
  cout << cnt << endl;
}
0