結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー d2verbd2verb
提出日時 2015-05-06 10:03:16
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 885 bytes
コンパイル時間 903 ms
コンパイル使用メモリ 87,392 KB
実行使用メモリ 8,768 KB
最終ジャッジ日時 2023-09-19 07:12:27
合計ジャッジ時間 7,725 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 5 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 8 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 TLE -
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 <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <complex>

using namespace std;

#define INF (INT_MAX/3)
#define PI (2*acos(0.0))
#define EPS (1e-8)

typedef long long ll;
typedef unsigned long long ull;
set<pair<int, int> > e;

int N, A[5001];

int solve(int x, int i){
    if(e.find(pair<int, int>(x, i)) != e.end()) return 0;
    if(i == N){
        e.insert(pair<int, int>(x, i));
        return 1;
    }
    return solve(x, i + 1) + solve(x ^ A[i], i + 1);
}

int main(){
    ios_base::sync_with_stdio(0);
    cin >> N;
    for(int i = 0; i < N; i++) cin >> A[i];
    cout << solve(0, 0) << endl;
    return 0;
}
0