結果
問題 |
No.183 たのしい排他的論理和(EASY)
|
ユーザー |
|
提出日時 | 2017-11-28 15:12:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 941 bytes |
コンパイル時間 | 530 ms |
コンパイル使用メモリ | 69,968 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 13:01:37 |
合計ジャッジ時間 | 4,086 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 2 |
other | RE * 18 |
ソースコード
#include <stdlib.h> #include <iostream> #include <vector> #include <string> #include <algorithm> #define rep(i,n) for(int i=0;i<n;i++) #define srep(i,a,n) for(int i=a;i<n;i++) #define REP(i,n) for(int i=0;i<=n;i++) #define SREP(i,a,n) for(int i=a;i<=n;i++) #define rrep(i,n) for(int i=n-1;i>=0;i--) #define RREP(i,n) for(int i=n;i>=0;i--) #define scan(x) cin >> x #define print(x) cout << x << endl #define fastcin {\ cin.tie(0);\ ios::sync_with_stdio(false);\ } using namespace std; typedef long long ll; /* Coding Space */ int max_num; int N; int A[5001]; bool** dp; int main(void) { fastcin; scan(N); SREP(n, 1, N) scan(A[n]); REP(n, 14) max_num += 1 << n; dp = new bool*[N + 1]; REP(n, N) { REP(m, N) dp[n][m] = new bool[max_num]; } dp[0][0] = true; SREP(n, 1, N) rep(a, max_num) { if (!dp[n - 1][a]) continue; dp[n][a] = true; dp[n][a ^ A[n]] = true; } print(count(dp[N], dp[N] + max_num, true)); return 0; }