結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー mizunomidorimizunomidori
提出日時 2016-07-03 22:43:14
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 858 bytes
コンパイル時間 1,173 ms
コンパイル使用メモリ 78,868 KB
実行使用メモリ 817,584 KB
最終ジャッジ日時 2024-04-20 21:43:02
合計ジャッジ時間 5,142 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>

#define N_MAX 5000

using namespace std;


int main(void)
{
    int N, A[N_MAX];
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    bool *can_make = new bool[1 << 15]();
    queue<int> q;
    q.push(0);
    while (!q.empty()) {
        int x = q.front();
        q.pop();
        can_make[x] = true;
        for (int i = 0; i < N; i++) {
            int y = x ^ A[i];
            if (!can_make[y]) {
                q.push(y);
            }
        }
    }
    cout << accumulate(can_make, can_make + (1 << 15), 0) << endl;
    return 0;
}
0