結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー penguinshunyapenguinshunya
提出日時 2019-03-21 22:27:16
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 232 ms / 5,000 ms
コード長 1,570 bytes
コンパイル時間 937 ms
コンパイル使用メモリ 108,212 KB
実行使用メモリ 147,216 KB
最終ジャッジ日時 2023-09-14 15:29:32
合計ジャッジ時間 3,663 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 212 ms
144,608 KB
testcase_08 AC 205 ms
131,612 KB
testcase_09 AC 141 ms
100,864 KB
testcase_10 AC 168 ms
116,060 KB
testcase_11 AC 224 ms
139,280 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 223 ms
125,760 KB
testcase_15 AC 232 ms
147,216 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 53 ms
39,432 KB
testcase_18 AC 206 ms
141,304 KB
testcase_19 AC 27 ms
20,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define repi(i, a, b) for (int i = (a); i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = long long;
using u32 = unsigned long long;
using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using vi32 = vector<i32>;
using vu32 = vector<u32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf64 = vector<f64>;
using vstr = vector<string>;
using vvi32 = vector<vi32>;
using vvu32 = vector<vu32>;
using vvi64 = vector<vi64>;
using vvu64 = vector<vu64>;
using vvf64 = vector<vf64>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

bool dp[5010][32800];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  dp[0][0] = true;
  int n;
  cin >> n;
  vi32 a(n);
  rep(i, n) cin >> a[i];
  rep(i, n) rep(j, 32800) {
    if (dp[i][j]) {
      dp[i + 1][j] = true;
      dp[i + 1][j ^ a[i]] = true;
    }
  }
  int ans = 0;
  rep(i, 32800) if (dp[n][i]) ans++;
  cout << ans << endl;
  return 0;
}
0