Submission #542650

# Submission time Handle Problem Language Result Execution time Memory
542650 2022-03-27T12:39:56 Z new_acc Secret (JOI14_secret) C++14
0 / 100
468 ms 4572 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;
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]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 118 ms 2536 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 318854190.
2 Incorrect 128 ms 2492 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 534774241.
3 Incorrect 118 ms 2504 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 204699730.
4 Incorrect 441 ms 4404 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 273285253.
5 Incorrect 449 ms 4488 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 509231116.
6 Incorrect 443 ms 4488 KB Wrong Answer: Query(200, 208) - expected : 277813445, actual : 942062966.
7 Incorrect 444 ms 4348 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 9155594.
8 Incorrect 468 ms 4572 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 828815616.
9 Incorrect 445 ms 4480 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 700983590.
10 Incorrect 437 ms 4428 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 813517315.