# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
117535 |
2019-06-16T12:52:53 Z |
tjd229 |
Secret (JOI14_secret) |
C++14 |
|
612 ms |
8460 KB |
#include "secret.h"
int range[1000][1000];
int _A[1000], _N;
void pre(int s, int e) {
if (s >= e) return;
int m = (s + e) >> 1;
for (int i = m - 1; i >= s; --i)
range[i][m] = Secret(_A[i],range[i+1][m]);
pre(s, m - 1);
++m;
for (int i = m + 1; i <= e; ++i)
range[m][i] = Secret(range[m][i - 1], _A[i]);
--m;
pre(m+1,e);
}
void Init(int N, int A[]) {
_N = N;
for (int i = 0; i < N; ++i) _A[i] =range[i][i]= A[i];
pre(0, N - 1);
}
int op(int s,int e,int l,int r) {
int m = (s+e)>>1;
if (m <= r && m + 1 >= l) {
if (r == m || m+1==l) return range[l][r];
return Secret(range[l][m],range[m+1][r]);
}
if (m > r) return op(s,m-1,l,r);
else return op(m + 2, e, l, r);
}
int Query(int L, int R) {
if (L == R) return _A[L];
else if (L + 1 == R) return Secret(_A[L], _A[R]);
return op(0,_N-1,L,R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
138 ms |
4444 KB |
Output is correct - number of calls to Secret by Init = 3331, maximum number of calls to Secret by Query = 1 |
2 |
Incorrect |
130 ms |
4472 KB |
Wrong Answer: Query(302, 393) - expected : 252755008, actual : 0. |
3 |
Incorrect |
129 ms |
4348 KB |
Wrong Answer: Query(334, 369) - expected : 363022362, actual : 536870912. |
4 |
Incorrect |
483 ms |
8244 KB |
Wrong Answer: Query(384, 458) - expected : 896057572, actual : 536870912. |
5 |
Incorrect |
469 ms |
8368 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 536870912. |
6 |
Incorrect |
480 ms |
8260 KB |
Wrong Answer: Query(200, 208) - expected : 277813445, actual : 536870912. |
7 |
Correct |
491 ms |
8460 KB |
Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
493 ms |
8308 KB |
Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1 |
9 |
Correct |
612 ms |
8352 KB |
Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
499 ms |
8312 KB |
Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1 |