結果

問題 No.183 たのしい排他的論理和(EASY)
コンテスト
ユーザー huka_huka
提出日時 2021-09-24 19:01:40
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 395 ms / 5,000 ms
コード長 868 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,680 ms
コンパイル使用メモリ 179,372 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2026-03-26 16:52:57
合計ジャッジ時間 5,808 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# 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