結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー |
![]() |
提出日時 | 2016-07-09 03:56:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 858 ms / 5,000 ms |
コード長 | 462 bytes |
コンパイル時間 | 151 ms |
コンパイル使用メモリ | 32,384 KB |
実行使用メモリ | 137,984 KB |
最終ジャッジ日時 | 2024-06-29 14:06:25 |
合計ジャッジ時間 | 5,127 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include <cstdio> using namespace std; bool dp[5555][1<<15]; int n; int a[5555]; int c[1<<15]; 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<<15; i++) res += c[i]; printf("%d\n", res); return 0; }