# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
52577 |
2018-06-26T07:37:56 Z |
이창수(#1969) |
비밀 (JOI14_secret) |
C++11 |
|
614 ms |
12824 KB |
#include "secret.h"
int a[1212], n;
int L[2212][1212];
int R[2212][1212];
void init(int now, int s, int e) {
if (s == e)return;
int m = (s + e) / 2;
init(now * 2, s, m), init(now * 2 + 1, m + 1, e);
L[now][0] = a[m]; R[now][0] = a[m + 1];
for (int i = m - 1, j = 1; i >= s; i--, j++)L[now][j] = Secret(a[i], L[now][j - 1]);
for (int i = m + 2, j = 1; i <= e; i++, j++)R[now][j] = Secret(R[now][j - 1], a[i]);
}
void Init(int N, int A[]) {
n = N;
for (int i = 0; i < N; i++)a[i] = A[i];
init(1, 0, n - 1);
}
int QR(int now, int l, int r, int s, int e) {
int m = (s + e) / 2;
if (l == 264 && r == 271)
int sp = 1;
if (r <= m)return QR(now*2, l, r, s, m);
if (m < l)return QR(now*2+1, l, r, m + 1, e);
return Secret(L[now][m - l], R[now][r - (m + 1)]);
}
int Query(int L, int R) {
if (L == R)return a[L];
return QR(1, L, R, 0, n - 1);
}
Compilation message
secret.cpp: In function 'int QR(int, int, int, int, int)':
secret.cpp:21:7: warning: unused variable 'sp' [-Wunused-variable]
int sp = 1;
^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
168 ms |
6484 KB |
Output is correct - number of calls to Secret by Init = 3578, maximum number of calls to Secret by Query = 1 |
2 |
Correct |
169 ms |
6792 KB |
Output is correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 1 |
3 |
Correct |
188 ms |
6792 KB |
Output is correct - number of calls to Secret by Init = 3595, maximum number of calls to Secret by Query = 1 |
4 |
Correct |
607 ms |
12384 KB |
Output is correct - number of calls to Secret by Init = 7969, maximum number of calls to Secret by Query = 1 |
5 |
Correct |
587 ms |
12480 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
6 |
Correct |
614 ms |
12524 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
7 |
Correct |
601 ms |
12568 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
614 ms |
12600 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
9 |
Correct |
614 ms |
12824 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
609 ms |
12824 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |