結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー mizunomidori
提出日時 2016-07-03 22:43:14
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
MLE  
実行時間 -
コード長 858 bytes
コンパイル時間 768 ms
コンパイル使用メモリ 78,848 KB
実行使用メモリ 817,720 KB
最終ジャッジ日時 2024-10-12 19:57:59
合計ジャッジ時間 5,398 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other MLE * 1 -- * 17
権限があれば一括ダウンロードができます

ソースコード

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