結果
問題 |
No.183 たのしい排他的論理和(EASY)
|
ユーザー |
![]() |
提出日時 | 2016-07-03 22:47:44 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 881 ms / 5,000 ms |
コード長 | 918 bytes |
コンパイル時間 | 604 ms |
コンパイル使用メモリ | 79,124 KB |
実行使用メモリ | 204,324 KB |
最終ジャッジ日時 | 2024-06-29 14:03:27 |
合計ジャッジ時間 | 5,570 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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); while (!q.empty()) { int x = q.front(); q.pop(); if (can_make[x]) { continue; } 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; }