結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー d2verbd2verb
提出日時 2015-05-06 09:46:45
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 927 bytes
コンパイル時間 940 ms
コンパイル使用メモリ 82,748 KB
実行使用メモリ 349,708 KB
最終ジャッジ日時 2023-09-19 07:09:11
合計ジャッジ時間 8,447 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
250,200 KB
testcase_01 AC 81 ms
250,300 KB
testcase_02 AC 82 ms
250,208 KB
testcase_03 AC 82 ms
250,208 KB
testcase_04 AC 82 ms
249,980 KB
testcase_05 AC 109 ms
250,368 KB
testcase_06 AC 79 ms
279,040 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;

int N, A[5001];
short memo[35000][5001];

int solve(int x, int i){
    if(memo[x][i] != -1) return 0;
    if(i == N){
        memo[x][i] = 1;
        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];
    for(int i = 0; i < 35000; i++) for(int j = 0; j <= N; j++) memo[i][j] = -1;
    cout << solve(0, 0) << endl;
    return 0;
}
0