結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー |
![]() |
提出日時 | 2017-10-05 22:03:50 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 141 ms / 5,000 ms |
コード長 | 566 bytes |
コンパイル時間 | 1,341 ms |
コンパイル使用メモリ | 159,388 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-30 03:15:39 |
合計ジャッジ時間 | 2,872 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include "bits/stdc++.h" using namespace std; #define rep(i,n) for(int i=0;i<n;i++) #define REP(i,x,n) for(int i=x;i<n;i++) #define ALL(v) (v).begin(),(v).end() #define MP(a,b) make_pair(a,b) typedef long long LL; typedef pair<int, int> PI; typedef vector<int> VI; const LL MOD = 1000000007LL; bool dp[2][1 << 15]; int A[5000]; int main() { int N; cin >> N; rep(i, N) cin >> A[i]; dp[0][0] = 1; rep(i, N) { int x = i & 1; rep(j, 1 << 15) dp[x ^ 1][j] = dp[x][j] | dp[x][j^A[i]]; } int ans = 0; rep(i, 1 << 15) ans += dp[N % 2][i]; cout << ans << endl; }