Submission #62646

# Submission time Handle Problem Language Result Execution time Memory
62646 2018-07-29T15:45:26 Z Diuven Secret (JOI14_secret) C++11
0 / 100
722 ms 8728 KB
#include "secret.h"
#include <assert.h>

static int A[1010];
static int B[1010][1010];

static int n;

void init(int s, int e){
	if(s==e){ B[s][s]=A[s]; return; }
	if(e<s) return;
	int m=(s+e)/2;
	init(s,m-1); init(m+1,e);
	B[m][m]=A[m], B[m+1][m+1]=A[m+1];
	for(int i=m-1; i>=s; i--) B[i][m]=Secret(A[i], B[i+1][m]);
	for(int i=m+1; i<=e; i++) B[m+1][i]=Secret(B[m+1][i-1], A[i]);
}

int get(int s, int e, int l, int r){
	int m=(s+e)/2;
	if(l<=m && m<=r) return m;
	if(r<m) return get(s,m-1,l,r);
	if(m<l) return get(m+1,e,l,r);
	assert(true);
}

void Init(int N, int _A[]){
	n=N;
	for(int i=0; i<n; i++) A[i]=_A[i];
	init(0,n-1);
}

int Query(int l, int r){
	if(l==r) return A[l];
	int m=get(0,n-1,l,r);
	if(m==r) return B[l][m];
	else return Secret(B[l][m], B[m+1][r]);
}

Compilation message

secret.cpp: In function 'int get(int, int, int, int)':
secret.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Incorrect 188 ms 4436 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 34031537.
2 Incorrect 169 ms 4456 KB Wrong Answer: Query(102, 157) - expected : 32612619, actual : 569483529.
3 Incorrect 170 ms 4532 KB Wrong Answer: Query(67, 224) - expected : 202440844, actual : 739311628.
4 Incorrect 662 ms 8728 KB Wrong Answer: Query(727, 872) - expected : 870334875, actual : 870334619.
5 Incorrect 603 ms 8728 KB Wrong Answer: Query(761, 790) - expected : 112945480, actual : 112871752.
6 Incorrect 722 ms 8728 KB Wrong Answer: Query(200, 208) - expected : 277813445, actual : 814416065.
7 Correct 684 ms 8728 KB Output is correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 1
8 Correct 715 ms 8728 KB Output is correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 1
9 Correct 722 ms 8728 KB Output is correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 1
10 Correct 717 ms 8728 KB Output is correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 1