結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー | tenman |
提出日時 | 2019-01-03 22:17:00 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 286 ms / 5,000 ms |
コード長 | 572 bytes |
コンパイル時間 | 1,463 ms |
コンパイル使用メモリ | 164,332 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-09-13 22:03:48 |
合計ジャッジ時間 | 4,619 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 3 ms
4,380 KB |
testcase_02 | AC | 3 ms
4,384 KB |
testcase_03 | AC | 3 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 3 ms
4,376 KB |
testcase_06 | AC | 3 ms
4,376 KB |
testcase_07 | AC | 255 ms
4,376 KB |
testcase_08 | AC | 254 ms
4,380 KB |
testcase_09 | AC | 175 ms
4,380 KB |
testcase_10 | AC | 211 ms
4,376 KB |
testcase_11 | AC | 276 ms
4,376 KB |
testcase_12 | AC | 3 ms
4,380 KB |
testcase_13 | AC | 2 ms
4,380 KB |
testcase_14 | AC | 284 ms
4,376 KB |
testcase_15 | AC | 286 ms
4,376 KB |
testcase_16 | AC | 3 ms
4,380 KB |
testcase_17 | AC | 64 ms
4,376 KB |
testcase_18 | AC | 246 ms
4,376 KB |
testcase_19 | AC | 32 ms
4,380 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; const int INF = 1e9; const int MOD = 1e9 + 7; // 4近傍、8近傍 int dx[] = {1, 0, -1, 0, 1, -1, -1, 1}; int dy[] = {0, 1, 0, -1, 1, 1, -1, -1}; int flag[50000]; int main() { int N; cin >> N; int a[N]; for (int i = 0; i < N; i++) cin >> a[i]; flag[0] = 1; for (int i = 0; i < N; i++) { for (int j = 50000; j >= 0; j--) { if (flag[j]) { flag[j^a[i]] = 1; } } } cout << accumulate(flag, flag + 50000, 0) << endl; return 0; }