結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー hokutohokuto
提出日時 2021-08-30 22:40:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 819 bytes
コンパイル時間 851 ms
コンパイル使用メモリ 99,808 KB
実行使用メモリ 663,552 KB
最終ジャッジ日時 2024-05-03 08:43:43
合計ジャッジ時間 6,327 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 4 ms
6,940 KB
testcase_03 AC 4 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 3 ms
6,940 KB
testcase_06 AC 3 ms
6,940 KB
testcase_07 MLE -
testcase_08 MLE -
testcase_09 AC 411 ms
405,504 KB
testcase_10 AC 487 ms
488,192 KB
testcase_11 MLE -
testcase_12 WA -
testcase_13 AC 2 ms
6,944 KB
testcase_14 MLE -
testcase_15 MLE -
testcase_16 AC 3 ms
6,944 KB
testcase_17 AC 155 ms
149,120 KB
testcase_18 MLE -
testcase_19 AC 74 ms
74,624 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,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