Submission #384097

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

int b[1000][1000], n;
vector<array<int, 2>> c;

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

	c.push_back({lx, rx});
}

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);
	for(auto z : c){
		int lx = z[0], rx = z[1];
		int mx = (lx+rx)/2;

		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]);
	}
}

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 205 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 222 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 207 ms 6508 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 8428 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 744 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 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
7 Partially correct 755 ms 8556 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 756 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 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
10 Partially correct 750 ms 8368 KB Output isn't correct - number of calls to Secret by Init = 258662, maximum number of calls to Secret by Query = 1