結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー | lapi |
提出日時 | 2019-08-10 19:27:22 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,193 bytes |
コンパイル時間 | 2,265 ms |
コンパイル使用メモリ | 119,984 KB |
実行使用メモリ | 101,160 KB |
最終ジャッジ日時 | 2023-09-26 23:35:51 |
合計ジャッジ時間 | 16,762 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 2 ms
4,384 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | AC | 2 ms
4,380 KB |
testcase_07 | WA | - |
testcase_08 | AC | 1,986 ms
90,536 KB |
testcase_09 | AC | 1,349 ms
64,844 KB |
testcase_10 | AC | 1,632 ms
75,364 KB |
testcase_11 | AC | 2,151 ms
97,932 KB |
testcase_12 | WA | - |
testcase_13 | AC | 2 ms
4,380 KB |
testcase_14 | AC | 147 ms
74,144 KB |
testcase_15 | AC | 2,246 ms
101,160 KB |
testcase_16 | AC | 3 ms
4,380 KB |
testcase_17 | AC | 489 ms
25,824 KB |
testcase_18 | WA | - |
testcase_19 | AC | 237 ms
15,632 KB |
ソースコード
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <stack> #include <queue> #include <list> #include <set> #include <map> #include <numeric> #include <regex> #include <tuple> #include <iomanip> #include <cmath> using namespace std; typedef long long ll; typedef pair<int, int> P; #define MOD 1000000007 // 10^9 + 7 #define INF 1000000000 // 10^9 #define LLINF 1LL<<60 // xor int XOR(int a, int b) { int res = 0; int dig = 1; while ((a > 0) || (b > 0)) { int tmpa = a % 2; int tmpb = b % 2; if (tmpa != tmpb) res += dig; dig *= 2; a /= 2; b /= 2; } return res; } bool poss[5009][20009]; int A[5009]; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; for (int i = 1; i <= N; i++) cin >> A[i]; //cout << "ok1" << endl; //cout << XOR(1, 2) << endl; poss[0][0] = true; for (int i = 0; i < N; i++) { for (int j = 0; j <= 16384; j++) { if (poss[i][j]) { poss[i + 1][j] = true; int nxt = XOR(j,A[i+1]); if (nxt <= 16384) poss[i + 1][nxt] = true; } } } //cout << "ok2" << endl; int ans = 0; for (int j = 0; j <= 20000; j++) { if (poss[N][j]) ans++; } cout << ans << endl; return 0; }