結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー hokutohokuto
提出日時 2021-08-30 22:45:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 820 bytes
コンパイル時間 890 ms
コンパイル使用メモリ 102,684 KB
実行使用メモリ 23,552 KB
最終ジャッジ日時 2024-05-03 08:48:19
合計ジャッジ時間 4,046 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 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 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 WA -
testcase_08 AC 329 ms
21,248 KB
testcase_09 AC 227 ms
15,616 KB
testcase_10 AC 276 ms
18,176 KB
testcase_11 AC 354 ms
22,784 KB
testcase_12 WA -
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 111 ms
23,552 KB
testcase_15 AC 372 ms
23,552 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 84 ms
7,680 KB
testcase_18 WA -
testcase_19 AC 41 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <utility>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
using namespace std;
using ll = long long int;
#define chmax(x,y)  x = (x > (y)) ? x : (x = (y));
#define chmin(x,y)  x = (x < (y)) ? x : (x = (y));


int main(int argc, char const *argv[])
{
  int N; cin >> N;
  vector<int> W(N);
  for(auto &e : W)cin >> e;

  vector<vector<bool>> dp(N+1,vector<bool>(pow(2,15),0));
  dp[0][0] = 1;
  for(int i=0;i<N;++i)
  {
    for(int j=0;j<=pow(2,14);++j)
    {
      if(dp[i][j])
      {
        dp[i+1][j] = dp[i][j];
        dp[i+1][j^W[i]] = dp[i][j];
      }
    }
  }
  int answer = 0;
  for(int i=0;i<=pow(2,14);++i)answer += dp[N][i];
  std::cout << answer << std::endl;
}
0