結果
問題 |
No.183 たのしい排他的論理和(EASY)
|
ユーザー |
![]() |
提出日時 | 2016-07-09 03:55:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 462 bytes |
コンパイル時間 | 367 ms |
コンパイル使用メモリ | 32,128 KB |
実行使用メモリ | 83,328 KB |
最終ジャッジ日時 | 2024-10-13 08:05:25 |
合計ジャッジ時間 | 4,724 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 WA * 3 |
ソースコード
#include <cstdio> using namespace std; bool dp[5555][1<<14]; int n; int a[5555]; int c[1<<14]; void solve(int p, int u) { if (dp[p][u]) return; if (p == n) { c[u] = 1; return; } solve(p+1, u); solve(p+1, u^a[p]); dp[p][u] = 1; } int main(void) { scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", a+i); } solve(0, 0); int res = 0; for (int i = 0; i < 1<<14; i++) res += c[i]; printf("%d\n", res); return 0; }