Submission #989295

# Submission time Handle Problem Language Result Execution time Memory
989295 2024-05-27T21:43:37 Z aaaaaarroz Secret (JOI14_secret) C++17
0 / 100
299 ms 4472 KB
#include <bits/stdc++.h>
using namespace std;
int Secret(int l, int r);
vector<vector<int>>dvc;
vector<int>arr;
void dc(int l, int r, int lvl){
	if(l==r){
		dvc[lvl][l]=arr[l];
		return;
	}
	int mid=(l+r)>>1;
	dvc[lvl][mid]=arr[mid];
	dvc[lvl][mid+1]=arr[mid+1];
	for(int i=mid-1;i>=l;i--){
		dvc[lvl][i]=Secret(dvc[lvl][i+1],arr[i]);
	}
	for(int i=mid+2;i<=r;i++){
		dvc[lvl][i]=Secret(dvc[lvl][i-1],arr[i]);
	}
	dc(l,mid,lvl+1);
	dc(mid+1,r,lvl+1);
}
void Init(int n, int a[]){ 
    arr.resize(n);
    for(int i=0;i<n;i++){
        arr[i]=a[i];
	}
    dvc.resize(15,vector<int>(n));
	dc(0,n-1,0);
}
int retorno(int a,int b,int l,int r, int lvl){
	int mid=(a+b)>>1;
	if(a==b){
		return dvc[lvl][a];
	}
	if(r<(mid+1)){
		return retorno(a,mid,l,r,lvl+1);
	}
	else if(l>mid){
		return retorno(mid+1,b,l,r,lvl+1);
	}
	return Secret(dvc[lvl][a],dvc[lvl][b]);
}
int Query(int l,int r){ 
    return retorno(0,arr.size()-1,l,r,0);
}
# Verdict Execution time Memory Grader output
1 Incorrect 71 ms 2648 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 54673711.
2 Incorrect 89 ms 2644 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 496578817.
3 Incorrect 79 ms 2652 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 20078928.
4 Incorrect 298 ms 4436 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 316342811.
5 Incorrect 286 ms 4432 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 627707150.
6 Incorrect 296 ms 4436 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 456183880.
7 Incorrect 289 ms 4256 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 673350762.
8 Incorrect 281 ms 4432 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 280414344.
9 Incorrect 290 ms 4472 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 962084259.
10 Incorrect 299 ms 4436 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 878715528.