結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー RyuRyu
提出日時 2018-02-28 09:00:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 201 ms / 5,000 ms
コード長 871 bytes
コンパイル時間 887 ms
コンパイル使用メモリ 83,072 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-12 16:42:13
合計ジャッジ時間 3,510 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 167 ms
4,384 KB
testcase_08 AC 178 ms
4,380 KB
testcase_09 AC 121 ms
4,380 KB
testcase_10 AC 147 ms
4,384 KB
testcase_11 AC 191 ms
4,384 KB
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 1 ms
4,384 KB
testcase_14 AC 189 ms
4,388 KB
testcase_15 AC 201 ms
4,380 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 AC 46 ms
4,384 KB
testcase_18 AC 164 ms
4,380 KB
testcase_19 AC 22 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <numeric>
#include <cstring>
#include <cmath>
#include <set>
#include <queue>
#include <stack>

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using edge = struct
{
    int to;
    int cost;
};

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

bool dp[1 << 15];

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    int ans = 0;

    dp[0] = true;
    
    rep(i, N)
    {
        rep(j, (1 <<15))
        {
            if(dp[j]) dp[A[i] ^ j] = true;
        }
    }

    rep(i, (1 << 15)) if(dp[i]) ans++;

    cout << ans << endl;
    return 0;
}
0