結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー 115Yuuta115Yuuta
提出日時 2017-10-05 18:21:15
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 580 bytes
コンパイル時間 1,138 ms
コンパイル使用メモリ 160,728 KB
実行使用メモリ 184,060 KB
最終ジャッジ日時 2024-04-28 07:47:18
合計ジャッジ時間 9,348 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define PI 4*atan(1)
#define INF 1e8

typedef long long ll;

int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

int n[17000] = {0};
int N;
int dp[5001][17000] = {0};
void dfs(int i, int x, vector<ll> A){
  if(i == N + 1)return;
  if(dp[i][x] == 1)return;
  
  // n[x^A[i]] = 1;
  dp[i][x] = 1;
  n[x] = 1;
  dfs(i + 1, x^A[i], A);
  dfs(i + 1, x, A);
}

int main(){
  cin >> N;
  vector<ll> A(N + 1, 0);
  for(int i = 0; i < N; i++)cin >> A[i];
  dfs(0, 0, A);
  int cnt = 0;
  for(auto t : n)if(t == 1)cnt++;
  cout << cnt << endl;
}
0