結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー NiwakaNiwaka
提出日時 2022-03-23 07:24:26
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 4,828 bytes
コンパイル時間 4,007 ms
コンパイル使用メモリ 145,008 KB
実行使用メモリ 664,704 KB
最終ジャッジ日時 2024-10-11 04:38:42
合計ジャッジ時間 15,500 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 7 MLE * 6 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <vector>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <sstream>
#include <set>
#include<stack>
#include <utility>
#include <tuple>
#include <unordered_map>
#include <string.h>
#include <iomanip>
#include <deque>
#include <climits>
#include <list>
#include <bitset>
//const long long MOD = 1000000000+7;
//const long long MOD = 998244353;
const long long MAX = 1000000000000000001;
//const long long MOD = 1000000000000000007;
using namespace std;
typedef long long llong;
typedef unsigned long long ullong;
#define INF (llong)1<<60
#define DEBUG cout << "Hello" << endl;
//int isalpha(char ch): ch true
//int isdigit(char ch): ch true
//int islower(char ch): ch true
//int isupper(char ch): ch true
//int tolower(char ch): ch
//int toupper(char ch): ch
//string
//sort(s.begin(), s.end(), greater<char>())
//size()
//Insert()
//erase()
//clear()
//substr()
//replace()
//c_str()
//<===使
//replace使
//reverse(str.begin(), str.end());
//map<type, type> dict;
//
//vector<vector<llong> > graph(N);
//
//sort(v.begin(), v.end(), std::greater<Type>());
//
//w[i] = w[i]-'A'+'a';
//vector
//assign 
//vector
//queue
//find()
//pop()
//push()
//priority_queue
//
//ceil
//floor
//size()
//vector0
//for(int k=0; k<(int)temp_list.size()-1; k++)
/***
vector<llong> v;
do{
}while(next_permutation(v.begin(), v.end()));
***/
//
/***
llong right, left, middle;
right = 2e9;//2000000000
left = 0;
while (right-left>1){
middle = left + (right - left) / 2;
***/
//double
//10
//printf("%.10lf\n", ans);
/***
//const llong mod = 1000000007;
//const llong mod = 998244353;
class mint {
public:
llong x; // typedef long long llong;
mint(llong x=0):x((x%mod+mod)%mod){}
mint operator-() const { return mint(-x);}
mint& operator+=(const mint a) {
if ((x += a.x) >= mod) x -= mod;
return *this;
}
mint& operator-=(const mint a) {
if ((x += mod-a.x) >= mod) x -= mod;
return *this;
}
mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
mint operator+(const mint a) const { return mint(*this) += a;}
mint operator-(const mint a) const { return mint(*this) -= a;}
mint operator*(const mint a) const { return mint(*this) *= a;}
mint pow(llong t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
}
// for prime mod
mint inv() const { return pow(mod-2);}
mint& operator/=(const mint a) { return *this *= a.inv();}
mint operator/(const mint a) const { return mint(*this) /= a;}
};
***/
/***
llong dfs(llong i, llong n, llong N, vector<vector<llong>>& dp){
if(i==N){
return 1;
}
if(dp[i][n]!=-1){
return dp[i][n];
}
mint total=0;
if(n-1>=1)total += dfs(i+1, n-1, N, dp);
total += dfs(i+1, n, N, dp);
if(n+1<=9)total += dfs(i+1, n+1, N, dp);
return dp[i][n]=total.x;
}
***/
//llong dx[4] = { 0, 1, 0, -1 };
//llong dy[4] = { 1, 0, -1, 0 };
llong N;
llong dfs(llong i, llong sum, vector<llong>& A, map<llong, llong>& table, vector<vector<llong> >& dp){
if(i==N){
if(table.count(sum)==0){
table[sum]++;
return 1;
}
return 0;
}
if(dp[i][sum]!=-1){
return dp[i][sum];
}
llong ans=0;
ans = dfs(i+1, sum^A[i], A, table, dp)+dfs(i+1, sum, A, table, dp);
return dp[i][sum]=ans;
}
int main(){
cin >> N;
vector<llong> A(N);
map<llong, llong> mp;
for(int i=0; i<N; i++){
cin >> A[i];
}
vector<vector<llong> > dp(N, vector<llong>(16385, -1));
cout << dfs(0, 0, A, mp, dp) << endl;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0