# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
62645 |
2018-07-29T15:43:19 Z |
Diuven |
Secret (JOI14_secret) |
C++11 |
|
742 ms |
9556 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);
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 |
205 ms |
4600 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 34031537. |
2 |
Incorrect |
183 ms |
4784 KB |
Wrong Answer: Query(102, 157) - expected : 32612619, actual : 569483529. |
3 |
Incorrect |
199 ms |
4932 KB |
Wrong Answer: Query(67, 224) - expected : 202440844, actual : 739311628. |
4 |
Incorrect |
730 ms |
8836 KB |
Wrong Answer: Query(727, 872) - expected : 870334875, actual : 870334619. |
5 |
Incorrect |
680 ms |
9132 KB |
Wrong Answer: Query(761, 790) - expected : 112945480, actual : 112871752. |
6 |
Incorrect |
690 ms |
9132 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 950134466. |
7 |
Correct |
684 ms |
9212 KB |
Output is correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
690 ms |
9296 KB |
Output is correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 1 |
9 |
Correct |
742 ms |
9556 KB |
Output is correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
682 ms |
9556 KB |
Output is correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 1 |