# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
542649 |
2022-03-27T12:39:37 Z |
new_acc |
Secret (JOI14_secret) |
C++14 |
|
0 ms |
0 KB |
#include "secret.h"
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
const int N=1e3+10;
const int L=13;
ll jj[N][L];
int t[N],n;
int Secret(int a,int b){
return a^b;
}
void dc(int a,int b,int x){
int sr=(a+b)>>1;
jj[sr][x]=t[sr];
if(a==b) return;
for(int i=sr-1;i>=a;i--) jj[i][x]=Secret(t[i],jj[i+1][x]);
for(int i=sr+1;i<=b;i++) jj[i][x]=Secret(jj[i-1][x],t[i]);
dc(a,sr,x+1),dc(sr+1,b,x+1);
}
pair<int,int> zn(int a,int b,int p=1,int k=n,int x=1){
int sr=(p+k)>>1;
if(a<=sr and b>=sr) return {x,sr};
if(a<=sr) return zn(a,b,p,sr,x+1);
return zn(a,b,sr+1,k,x+1);
}
void Init(int NN,int A[]){
n=NN;
for(int i=1;i<=n;i++) t[i]=A[i-1];
dc(1,n,1);
}
int Query(int a,int b){
a++,b++;
pair<int,int> curr=zn(a,b);
if(curr.se==a) return jj[b][curr.fi];
if(curr.se==b) return jj[a][curr.fi];
return Secret(jj[a][curr.fi],jj[b][curr.fi]);
}
Compilation message
/usr/bin/ld: /tmp/ccJpFHSJ.o: in function `Secret(int, int)':
secret.cpp:(.text+0x0): multiple definition of `Secret(int, int)'; /tmp/ccaGeSxI.o:grader-full.cpp:(.text+0x2d0): first defined here
collect2: error: ld returned 1 exit status