Submission #384099

# Submission time Handle Problem Language Result Execution time Memory
384099 2021-03-31T12:45:23 Z ritul_kr_singh Secret (JOI14_secret) C++17
6 / 100
755 ms 8428 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 204 ms 6252 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 205 ms 6376 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 751 ms 8172 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 750 ms 8300 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 752 ms 8308 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 749 ms 8300 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 751 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 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
10 Partially correct 754 ms 8428 KB Output isn't correct - number of calls to Secret by Init = 258662, maximum number of calls to Secret by Query = 1