結果
問題 |
No.183 たのしい排他的論理和(EASY)
|
ユーザー |
![]() |
提出日時 | 2015-08-28 11:31:31 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 479 ms / 5,000 ms |
コード長 | 710 bytes |
コンパイル時間 | 736 ms |
コンパイル使用メモリ | 78,544 KB |
実行使用メモリ | 23,552 KB |
最終ジャッジ日時 | 2024-06-29 02:43:32 |
合計ジャッジ時間 | 4,346 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include <iostream> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <algorithm> #include <cmath> #include <string> using namespace std; typedef long long LL; #define range(i,a,b) for(int i=(a); i < (b); i++) #define rep(i,n) range(i,0,n) #define MAX_INT 2147483647 int main(){ int N, M = 1<<15, ans = 0; vector< vector<bool> > dp; cin >> N; dp = vector< vector<bool> >(N, vector<bool>(M, false)); LL A[N]; rep(i,N) cin >> A[i]; dp[0][0] = true; dp[0][A[0]] = true; rep(i,N-1){ rep(j,M){ if(dp[i][j]){ dp[i+1][j] = true; dp[i+1][j^A[i+1]] = true; } } } rep(i,M) ans += dp[N-1][i]; cout << ans << endl; return 0; }