結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー | 小指が強い人 |
提出日時 | 2016-01-09 00:37:29 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 3,901 ms / 5,000 ms |
コード長 | 588 bytes |
コンパイル時間 | 586 ms |
コンパイル使用メモリ | 73,212 KB |
実行使用メモリ | 5,252 KB |
最終ジャッジ日時 | 2023-09-11 23:03:22 |
合計ジャッジ時間 | 17,346 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 4 ms
4,384 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 7 ms
4,376 KB |
testcase_06 | AC | 1 ms
4,380 KB |
testcase_07 | AC | 3,901 ms
5,252 KB |
testcase_08 | AC | 1,702 ms
4,540 KB |
testcase_09 | AC | 1,190 ms
4,380 KB |
testcase_10 | AC | 1,407 ms
4,544 KB |
testcase_11 | AC | 1,861 ms
4,376 KB |
testcase_12 | AC | 10 ms
5,036 KB |
testcase_13 | AC | 1 ms
4,376 KB |
testcase_14 | AC | 3 ms
4,380 KB |
testcase_15 | AC | 1,927 ms
4,380 KB |
testcase_16 | AC | 2 ms
4,376 KB |
testcase_17 | AC | 431 ms
4,380 KB |
testcase_18 | AC | 2,890 ms
5,092 KB |
testcase_19 | AC | 208 ms
4,488 KB |
ソースコード
#include <iostream> #include <unordered_map> using namespace std; int main(void) { int n; int a[5000]; unordered_map<int, bool> dp; cin >> n; for(int i = 0; i < n; i++) cin >> a[i]; dp[0] = true; for(int i = 0; i < n; i++) { unordered_map<int, bool> buf; for(auto p : dp) { int x = a[i] ^ p.first; if(dp.count(x) > 0 || buf.count(x) > 0) continue; buf[x] = true; } for(auto t : buf) dp[t.first] = true; } cout << dp.size() << endl; return 0; }