Submission #321621

# Submission time Handle Problem Language Result Execution time Memory
321621 2020-11-12T23:12:16 Z bigg Secret (JOI14_secret) C++14
0 / 100
496 ms 4588 KB
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
int tot, maxa;
int qual[MAXN][15];
int a[MAXN];
int n;
void recur(int l, int r, int altura){

	if(l >= r || l == r-1) return;
	int mid = (l + r)/2;
	qual[mid][altura] = a[mid];
	qual[mid+1][altura] = a[mid+1];
	for(int i = mid - 1; i >= l; i--)qual[i][altura] = Secret(a[i], qual[i+1][altura]);
	for(int i = mid + 2; i <= r; i++)qual[i][altura] = Secret(a[i], qual[i-1][altura]);
	recur(l, mid-1, altura + 1);
	recur(mid + 1, r, altura + 1);
}
int makeans(int x, int y, int L, int R, int altura){
	int mid = (x+y)/2;
	if(R < mid) return makeans(x, mid - 1, L, R, altura + 1);
	if(L > mid) return(makeans(mid + 1, y, L, R, altura + 1));

	return Secret(qual[L][altura], qual[R][altura]);
}

void Init(int N, int A[]) {
	n = N;
  	for(int i = 1; i <= N; i++) a[i] = A[i-1];
	recur(1, n, 0);
	//printf("%d %d\n", tot, maxa);
}

int Query(int L, int R) {
	L++;
	R++;
	if(L==R) return a[L];
	if( L == R-1) return Secret(a[L], a[R]);
	return makeans(1,n,L,R,0);
  return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 136 ms 2560 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 809782271.
2 Incorrect 132 ms 2540 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 134 ms 2672 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820.
4 Incorrect 492 ms 4460 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 650789536.
5 Incorrect 495 ms 4588 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Incorrect 493 ms 4460 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 730510755.
7 Incorrect 493 ms 4588 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 493 ms 4588 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 496 ms 4556 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 493 ms 4324 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.