# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
439830 |
2021-06-30T23:41:00 Z |
julian33 |
Secret (JOI14_secret) |
C++14 |
|
566 ms |
4544 KB |
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
#ifdef LOCAL
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {
cerr<<vars<<" = ";
string delim="";
(...,(cerr<<delim<<values,delim=", "));
cerr<<"\n";
}
#else
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {}
#endif
#define pb push_back
#define sz(x) (int)(x.size())
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> inline void maxa(T& a,T b){a=max(a,b);}
template<typename T> inline void mina(T& a,T b){a=min(a,b);}
const int mxN=1e3+5;
int a[mxN],pieceofshit[mxN][10],n;
// int Secret(int x,int y){
// return x^y;
// }
void build(int v,int l,int r){
if(l>=r)
return;
int mid=(l+r)>>1;
build(v+1,l,mid);
build(v+1,mid+1,r);
pieceofshit[mid][v]=a[mid];
pieceofshit[mid+1][v]=a[mid+1];
for(int i=mid-1;i>=l;i--){
assert(pieceofshit[i+1][v]<=1e9);
pieceofshit[i][v]=Secret(pieceofshit[i+1][v],a[i]);
}
for(int i=mid+2;i<=r;i++){
assert(pieceofshit[i-1][v]<=1e9);
pieceofshit[i][v]=Secret(pieceofshit[i-1][v],a[i]);
}
}
int query(int v,int l,int r,int lq,int rq){
int mid=(l+r)>>1;
if(lq>mid+1)
return query(v+1,mid+1,r,lq,rq);
if(rq<mid)
return query(v+1,l,mid,lq,rq);
if(lq<=mid && rq>mid){
assert(pieceofshit[lq][v]<=1e9);
assert(pieceofshit[rq][v]<=1e9);
return Secret(pieceofshit[lq][v],pieceofshit[rq][v]);
}
if(lq==mid+1)
return pieceofshit[rq][v];
if(rq==mid)
return pieceofshit[lq][v];
assert(false);
}
int Query(int L, int R){
if(L==R)
return a[L];
return query(0,0,n-1,L,R);
}
void Init(int N, int A[]){
for(int i=0;i<N;i++)
a[i]=A[i];
build(0,0,N-1);
n=N;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
141 ms |
2464 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 268854015. |
2 |
Incorrect |
140 ms |
2444 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560. |
3 |
Incorrect |
144 ms |
2372 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500. |
4 |
Incorrect |
566 ms |
4372 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568. |
5 |
Incorrect |
535 ms |
4348 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316. |
6 |
Incorrect |
530 ms |
4340 KB |
Wrong Answer: Query(200, 208) - expected : 277813445, actual : 154975445. |
7 |
Incorrect |
531 ms |
4352 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873. |
8 |
Incorrect |
523 ms |
4440 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792. |
9 |
Incorrect |
523 ms |
4312 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577. |
10 |
Incorrect |
536 ms |
4544 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787. |