답안 #52569

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
52569 2018-06-26T07:25:54 Z 이창수(#1969) 비밀 (JOI14_secret) C++11
0 / 100
20000 ms 11480 KB
#include "secret.h"
int a[1212], n;
int L[1212][1212];
int R[1212][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; j <= 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 (m < l)return QR(now*2, l, r, s, m);
	if (r < m)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);
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 20036 ms 6776 KB Time limit exceeded
2 Execution timed out 20072 ms 6848 KB Time limit exceeded
3 Execution timed out 20051 ms 6904 KB Time limit exceeded
4 Incorrect 868 ms 11400 KB Wrong Answer [1]
5 Incorrect 862 ms 11400 KB Wrong Answer [1]
6 Incorrect 880 ms 11400 KB Wrong Answer [1]
7 Incorrect 868 ms 11400 KB Wrong Answer [1]
8 Incorrect 878 ms 11412 KB Wrong Answer [1]
9 Incorrect 990 ms 11480 KB Wrong Answer [1]
10 Incorrect 886 ms 11480 KB Wrong Answer [1]