結果
問題 |
No.183 たのしい排他的論理和(EASY)
|
ユーザー |
![]() |
提出日時 | 2015-11-12 18:54:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 143 ms / 5,000 ms |
コード長 | 546 bytes |
コンパイル時間 | 455 ms |
コンパイル使用メモリ | 65,464 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 11:09:13 |
合計ジャッジ時間 | 2,004 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include<iostream> #include<vector> #include<set> #include<numeric> int main() { int switches; std::cin >> switches; std::set<int> s; for (int i = 0; i < switches;i++){ int num; std::cin >> num; s.insert(num); } const int max = 1 << 15; bool ans[max] = {false}; ans[0] = true; for (std::set<int>::iterator it = s.begin(); it != s.end(); ++it) { for (int j = 0; j < max; j++) { if(ans[j]) ans[j ^ *it] = true; } } int a = 0; for (int i = 0; i < max; i++) { a += ans[i]; } std::cout << a << std::endl; return 0; }