結果
問題 |
No.183 たのしい排他的論理和(EASY)
|
ユーザー |
![]() |
提出日時 | 2016-07-03 22:52:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 216 ms / 5,000 ms |
コード長 | 919 bytes |
コンパイル時間 | 608 ms |
コンパイル使用メモリ | 78,948 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-29 14:03:29 |
合計ジャッジ時間 | 2,265 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#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); can_make[0] = true; 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); can_make[y] = true; } } } cout << accumulate(can_make, can_make + (1 << 15), 0) << endl; return 0; }