Submission #384094

# Submission time Handle Problem Language Result Execution time Memory
384094 2021-03-31T12:34:30 Z ritul_kr_singh Secret (JOI14_secret) C++17
6 / 100
794 ms 8556 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;

int b[1000][1000], n;

void PreCalc(int lx, int rx){
	if(rx-lx<=2) return;
	int mx = (lx+rx)/2;
	PreCalc(lx, mx);
	PreCalc(mx, rx);

	for(int i=mx-2; i>=0; --i)
		b[i][mx-1] = Secret(b[i][i], b[i+1][mx-1]);
	for(int i=mx+1; i<rx; ++i)
		b[mx][i] = Secret(b[mx][i-1], b[i][i]);
}

void Init(int N, int a[]){
	n = N;
	for(int i=0; i<1000; ++i)
		for(int j=0; j<1000; ++j)
			b[i][j] = i-j ? -1 : a[i];
	PreCalc(0, n);
}

int Calc(int l, int r, int lx, int rx){
	int mx = (lx+rx)/2;
	if(r<mx) return Calc(l, r, lx, mx);
	if(l>=mx) return Calc(l, r, mx, rx);
	return Secret(b[l][mx-1], b[mx][r]);
}

int Query(int L, int R){
	if(L==R) return b[L][L];
	if(L+1==R) return Secret(b[L][L], b[R][R]);
	return Calc(L, R, 0, n);
}
# Verdict Execution time Memory Grader output
1 Partially correct 214 ms 6508 KB Output isn't correct - number of calls to Secret by Init = 66563, maximum number of calls to Secret by Query = 1
2 Partially correct 207 ms 6380 KB Output isn't correct - number of calls to Secret by Init = 66818, maximum number of calls to Secret by Query = 1
3 Partially correct 208 ms 6380 KB Output isn't correct - number of calls to Secret by Init = 67337, maximum number of calls to Secret by Query = 1
4 Partially correct 755 ms 8556 KB Output isn't correct - number of calls to Secret by Init = 258197, maximum number of calls to Secret by Query = 1
5 Partially correct 789 ms 8428 KB Output isn't correct - number of calls to Secret by Init = 258662, maximum number of calls to Secret by Query = 1
6 Partially correct 753 ms 8512 KB Output isn't correct - number of calls to Secret by Init = 258662, maximum number of calls to Secret by Query = 1
7 Partially correct 755 ms 8428 KB Output isn't correct - number of calls to Secret by Init = 258662, maximum number of calls to Secret by Query = 1
8 Partially correct 794 ms 8428 KB Output isn't correct - number of calls to Secret by Init = 258662, maximum number of calls to Secret by Query = 1
9 Partially correct 761 ms 8380 KB Output isn't correct - number of calls to Secret by Init = 258662, maximum number of calls to Secret by Query = 1
10 Partially correct 748 ms 8428 KB Output isn't correct - number of calls to Secret by Init = 258662, maximum number of calls to Secret by Query = 1