結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー hiromi-mihiromi-mi
提出日時 2018-12-31 11:32:23
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 732 bytes
コンパイル時間 581 ms
コンパイル使用メモリ 62,384 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-20 06:04:47
合計ジャッジ時間 1,741 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 WA -
testcase_08 AC 62 ms
6,940 KB
testcase_09 AC 42 ms
6,940 KB
testcase_10 AC 56 ms
6,944 KB
testcase_11 AC 69 ms
6,944 KB
testcase_12 WA -
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 74 ms
6,940 KB
testcase_15 AC 74 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 17 ms
6,940 KB
testcase_18 WA -
testcase_19 AC 9 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <numeric>
#include <tuple>
#include <cstdio>
#include <assert.h>

using namespace std;

typedef long long ll;


#define rep(i,b) for(ll i=0;i<(b);++i)
#define rep1(i,b) for(ll i=1;i<=(b);++i)
#define vec vector
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

int N;
int A[5010];
int dp[(1 << 15) + 1];

int main() {
   cin >> N;
   rep(i, N) {
      cin >> A[i];
      dp[A[i]] = 1;
   }
   for (int i=0;i<=N;i++) {
      for (int j=(1 << 14);j>=0;j--) {
         dp[j ^ A[i]] |= dp[j] & dp[A[i]];
      }
   }
   int ans = 0;
   rep(i, (1 << 14)+1) {
      ans += dp[i];
   }
   cout << ans << endl;
}
0