結果
問題 |
No.183 たのしい排他的論理和(EASY)
|
ユーザー |
![]() |
提出日時 | 2015-11-12 18:45:55 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 617 bytes |
コンパイル時間 | 527 ms |
コンパイル使用メモリ | 66,108 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-13 14:30:52 |
合計ジャッジ時間 | 1,973 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 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); } // 排他的論理和は%で置き換えることができる bool ans[32768] = {false}; ans[0] = true; std::cout << ans[0] << std::endl; for (std::set<int>::iterator it = s.begin(); it != s.end(); ++it) { for (int j = 0; j < 32768; j++) { ans[ans[j] ^ *it] = true; } } int a = 0; for (int i = 0; i < 32768; i++) { a += ans[i]; } std::cout << a << std::endl; return 0; }