#include <iostream>
#include <vector>
#include <set>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <stdio.h>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <fstream>
#include <complex>
#include <stack>
#include <bitset>
#include <set>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define ll long long int
#define vi vector<int>
#define ii pair<ll,ll>
#define pb push_back
#define mp make_pair
#define vv vector
#define ff first
#define ss second
#define pll pair<ll,ll>
#define cd complex<double>
#define ld long double
#define pld pair<ld,ld>
#define iii pair<ii,int>
using namespace std;
const ll MOD = 998244353;
bool isV(int* arr,int n,int l,int r){
int x = 0;
int v = (1<<n)-1;
n = 1 << n;
FORE(i,l,r)x ^= arr[i];
if(x == v)return 1;
//cout << l << " " << r << " " << v << " " << x << endl;
FOR(i,n){
if(l <= i and i <= r)continue;
FOR(j,n){
if(j < l or j > r)continue;
//cout << i << " " << j << endl;
if((x^arr[i]^arr[j]) == v){
return 1;
}
}
}
cout << l+1 << " " << r+1 << " " << x << endl;
return 0;
}
#define endl '\n'
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
int n2 = n;
n = 1<<n;
int arr[n];
FOR(i,n)cin >> arr[i];
int ctr = 0;
FOR(i,n){
FOR(j,n){
int sum = 0;
FORE(x,i,j)sum ^= arr[x];
if(i < j and sum == 0){
ctr++;
//cout << "OO : " << i+1 << " " << j+1 << endl;
}
if(i <= j){
//ctr += isV(arr,n2,i,j);
}else{
//cout << i+1 << " " << j+1 << endl;
}
}
}
cout << ctr << endl;
return 0;
}
Compilation message
dojave.cpp: In function 'int main()':
dojave.cpp:71:9: warning: unused variable 'n2' [-Wunused-variable]
int n2 = n;
^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4090 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4073 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4085 ms |
504 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4016 ms |
1016 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4002 ms |
888 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4096 ms |
3008 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4078 ms |
11512 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4054 ms |
11620 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |