結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー hokutohokuto
提出日時 2021-08-30 22:36:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 821 bytes
コンパイル時間 870 ms
コンパイル使用メモリ 98,480 KB
実行使用メモリ 323,584 KB
最終ジャッジ日時 2024-05-03 08:40:07
合計ジャッジ時間 7,921 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 RE -
testcase_08 AC 352 ms
288,256 KB
testcase_09 AC 243 ms
198,400 KB
testcase_10 AC 289 ms
238,464 KB
testcase_11 AC 383 ms
312,448 KB
testcase_12 RE -
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 316 ms
323,584 KB
testcase_15 AC 400 ms
323,584 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 87 ms
73,984 KB
testcase_18 RE -
testcase_19 AC 44 ms
37,888 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<int>> dp(N+1,vector<int>(pow(2,14)+1,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