結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー |
|
提出日時 | 2017-11-28 18:12:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 238 ms / 5,000 ms |
コード長 | 404 bytes |
コンパイル時間 | 565 ms |
コンパイル使用メモリ | 68,840 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 03:27:24 |
合計ジャッジ時間 | 2,578 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include <iostream> #include <algorithm> using namespace std; const int _max = 1 << 15; int N; int dp[2][_max]; int main(void) { cin >> N; dp[0][0] = true; for (int n = 1; n <= N; ++n) { int a; cin >> a; for (int i = 0; i < _max; ++i) { dp[n % 2][i] |= dp[(n - 1) % 2][i]; dp[n % 2][i ^ a] |= dp[(n - 1) % 2][i]; } } cout << count(dp[N % 2], dp[N % 2] + _max, true) << endl; return 0; }