QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#527933 | #8520. Xor Partitions | Shunpower | WA | 1ms | 5692kb | C++14 | 2.1kb | 2024-08-22 23:05:45 | 2024-08-22 23:05:48 |
Judging History
answer
//Author:Leftist_G / Shunpower
//Moon Land & Letter to Past
//Hey Left
//Just enjoy the loneliness
//Open a personal party always stay
#include <bits/stdc++.h>
#define ET return 0
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define ll long long
#define ull unsigned long long
#define inf INT_MAX
#define uinf INT_MIN
#define pii pair<int,int>
#define pll pair<ll,ll>
#define debug puts("--------Chery AK IOI--------");
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define pt puts("")
#define fr1(i,a,b) for(int i=a;i<=b;i++)
#define fr2(i,a,b) for(int i=a;i>=b;i--)
#define fv(i,p) for(int i=0;i<p.size();i++)
#define ld long double
#define il inline
#define ptc putchar
using namespace std;
const int N=3e5+10;
namespace Shun{
int lowbit(int x){
return x&-x;
}
template <typename T>
inline void read(T &x){
T s=0,w=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-'){
w=-1;
}
ch=getchar();
}
while(ch>='0'&&ch<='9'){
s=s*10+ch-'0';
ch=getchar();
}
x=s*w;
}
template <typename T>
inline void write(T x){
if(x<0){
putchar('-');
x=-x;
}
if(x>9){
write(x/10);
}
putchar(x%10+'0');
}
}
using namespace Shun;
const int mod=1e9+7;
int n;
ll a[N];
ll xsum[N];
int dp[N];
int bol[63][2];
il void add(int &x,int y){
x+=y;
if(x>=mod) x-=mod;
}
int main(){
#ifdef Shun
freopen(".in","r",stdin);
freopen(".out","w",stdout);
#endif
ios::sync_with_stdio(false);
cin>>n;
fr1(i,1,n) cin>>a[i],xsum[i]=xsum[i-1]^a[i];
dp[0]=1;
fr1(i,0,62) bol[i][0]=1;
fr1(i,1,n){
fr1(j,0,4){
add(dp[i],1ll*(1ll<<j)%mod*bol[j][!((xsum[i]>>j)&1)]%mod);
// cout<<i<<" "<<j<<" "<<dp[i]<<" "<<((xsum[i]>>j)&1)<<endl;
}
fr1(j,0,4) add(bol[j][(xsum[i]>>j)&1],dp[i]);
// cout<<dp[i]<<'\n';
}
cout<<dp[n]<<'\n';
ET;
}
//ALL FOR Zhang Junhao.
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5612kb
input:
4 7 3 1 2
output:
170
result:
ok 1 number(s): "170"
Test #2:
score: 0
Accepted
time: 1ms
memory: 5564kb
input:
1 0
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 1ms
memory: 5672kb
input:
1 1
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 1ms
memory: 5672kb
input:
3 1 2 3
output:
16
result:
ok 1 number(s): "16"
Test #5:
score: 0
Accepted
time: 1ms
memory: 5608kb
input:
4 0 1 0 1
output:
2
result:
ok 1 number(s): "2"
Test #6:
score: -100
Wrong Answer
time: 1ms
memory: 5692kb
input:
562 918479109239293921 960173570446350728 374394588863436385 418106819278123099 473761712658352147 662782574081105364 824954323015093862 827581845536521847 184394794881199801 820907621998888642 606529830885621237 961790689782125501 582742201855597942 337901250755571075 287706594894797714 18578215893...
output:
69490398
result:
wrong answer 1st numbers differ - expected: '641941658', found: '69490398'