# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
62649 |
2018-07-29T15:49:01 Z |
Diuven |
Secret (JOI14_secret) |
C++11 |
|
715 ms |
9172 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(e<=s) return;
int m=(s+e)/2;
init(s,m-1); init(m+1,e);
for(int i=m-1; i>=s; i--) B[i][m]=Secret(A[i], B[i+1][m]);
for(int i=m+2; 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];
for(int i=0; i<n; i++) B[i][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:23:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
180 ms |
4600 KB |
Output is correct - number of calls to Secret by Init = 3331, maximum number of calls to Secret by Query = 1 |
2 |
Correct |
197 ms |
4676 KB |
Output is correct - number of calls to Secret by Init = 3339, maximum number of calls to Secret by Query = 1 |
3 |
Correct |
178 ms |
4728 KB |
Output is correct - number of calls to Secret by Init = 3347, maximum number of calls to Secret by Query = 1 |
4 |
Correct |
646 ms |
8696 KB |
Output is correct - number of calls to Secret by Init = 7467, maximum number of calls to Secret by Query = 1 |
5 |
Correct |
684 ms |
8696 KB |
Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1 |
6 |
Correct |
707 ms |
8820 KB |
Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1 |
7 |
Correct |
710 ms |
8936 KB |
Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
707 ms |
9060 KB |
Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1 |
9 |
Correct |
715 ms |
9172 KB |
Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
706 ms |
9172 KB |
Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1 |