/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Wrong Answer 1ms 320.0 KiB
#3 Wrong Answer 172ms 420.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M int(1e9+7)

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


    int t;cin>>t;while(t--){
        int n;cin>>n;
        vector<int>v(n);

        for(int i=0;i<n;i++){
            cin>>v[i];
        }

        int l=0,m=2,r=n;

        int x1=0,x2=0;
        int count=0;

        while(m<=n){
            for(int i=l;i<m;i++){
                x1=x1^v[i];
            }

            for(int i=m;i<r;i++){
                x2=x2^v[i];
            }

            if(x1==x2){
                count++;
                x1=0,x2=0,
                m++;
            }
            else{
                m++;
            }

    

        }

        cout<<count<<endl;


        
    }
     return 0;
}

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:25:19
Judged At
2024-12-17 11:34:46
Judged By
Score
10
Total Time
172ms
Peak Memory
420.0 KiB