/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 1ms 536.0 KiB
#3 Wrong Answer 16ms 532.0 KiB
#4 Wrong Answer 39ms 3.52 MiB
#5 Wrong Answer 18ms 3.562 MiB
#6 Wrong Answer 17ms 532.0 KiB
#7 Wrong Answer 18ms 532.0 KiB
#8 Wrong Answer 23ms 564.0 KiB
#9 Wrong Answer 38ms 3.445 MiB
#10 Wrong Answer 41ms 3.543 MiB

Code

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define hello() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define nl "\n"
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl
#define ss second
#define ff first
#define all(v) v.begin(),v.end()
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pb push_back
#define mod 1000000007
#define mem(a,x) memset(a,x,sizeof(a))
int bit(ll a,int i){if(a&(1LL<<i)) return 1;return 0;}
template <typename num_t>
using os = tree<num_t, null_type, less_equal<num_t>, rb_tree_tag, tree_order_statistics_node_update>;
//os.order_of_key(x) returs number of elements strictly smaller than x;
//*(os.find_by_order(x)) returns which elemnt is in position x;simply work as ar[x]
int dx[]={1,-1,0,0,1,1,-1,-1};
int dy[]={0,0,1,-1,1,-1,1,-1};
ll isqrt (ll x){ll ans = 0;for (ll k = 1LL << 30; k != 0; k /= 2){if ((ans + k) * (ans + k) <= x) {ans += k;}}return ans;}
ll bin(ll n,ll pow){ll result=1;while(pow){if(pow&1){result=(result * n);}n=(n*n);pow>>=1;}return result;}
ll binmod(ll a,ll b,ll MOD){ll ans=1;a%=MOD;while(b){if(b&1)ans=(ans*a)%MOD;b/=2;a=(a*a)%MOD;}return ans;}
ll inverse(ll a,ll MOD){return binmod(a,MOD-2,MOD);}
const int N=2e5+12;
const  int M=998244353;
int bigmod(int a, int b)
{
    int ans =1;
    while(b>0)
    {
        if(b&1)
        {
            ans = (ans*1ll*a)%mod;
        }
        a= (a*1ll*a)%mod;
        b>>=1;
    }
    return ans;
}

inline int add(int x, int y)
{
    return (x+y>=mod ? x+y-mod : x+y);
}

inline int sub(int x, int y)
{
    return (x-y<0 ? x-y+mod : x-y);
}

inline int gun(int x, int y)
{
    return ((x*1ll*y)%mod);
}

inline int vag(int x, int y)
{
    return (x*1ll* bigmod(y,mod - 2))%mod;
}
int fact[N];
int invfact[N];
int inv[N];

void init() //must initialize first(everytime i forget)
{
    fact[0]=1;
    invfact[0] = 1;
    inv[1] = 1;
    for (int i = 2; i < N; i++)
        inv[i] = inv[mod % i] *1ll* (mod - mod / i) % mod;
    for(int i=1; i<N; i++)
    {
        fact[i]= gun(fact[i-1],i);
        invfact[i] = invfact[i - 1] *1ll* inv[i] % mod;
    }
}

int ncr(int n, int r)
{
    if(n<r || n<0 || r<0)
    {
        return 0;
    }
    return gun(fact[n] , gun(invfact[r] , invfact[n-r]));
}

void solve(){
    ll n,k;cin>>n;
    vector<ll>a(n),pre(n);
    for(int i=0;i<n;i++){
            cin>>a[i];
            if(i==0)pre[i]=a[i];
            else pre[i]=a[i]^pre[i-1];
    }
    ll l,r,ans=0;
    for(int i=0;i<n-1;i++){
       if(pre[i]==pre[n-1]^pre[i])ans++;
    }

    cout<<ans<<nl;
}
int main()
{
     hello();
cout.precision(10); cout.setf(ios::fixed);
     int tc;
     cin>>tc;
   for(int j=1;j<=tc;j++){
     //cout<<"Case "<<j<<": ";
        solve();
  }
}

Information

Submit By
Type
Submission
Problem
P1096 Mr. Heart and the XOR Puzzle
Contest
Brain Booster #6
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-03 16:12:29
Judged At
2024-10-03 16:12:29
Judged By
Score
10
Total Time
41ms
Peak Memory
3.562 MiB