답안 #70293

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70293 2018-08-22T14:49:25 Z MladenP 비밀 (JOI14_secret) C++17
0 / 100
20000 ms 8552 KB
#include "secret.h"
#define mid (l+r)/2
#define I int
#define G return
#define S Secret
int n,i,a[1010],d[1010][1010];
void Z(int l, int r) {
	if(l >= r) return;
	for(i = mid+1; i <= r; i++) d[mid][i] = S(d[mid][i-1], a[i]);
	for(i = mid-2; i >= l; i--) d[i][mid-1] = S(a[i], d[i+1][mid-1]);
	Z(l, mid-1);Z(mid, r);
}
int query(int l, int r, int L, int R) {
	if(L == mid) return d[mid][R];
	if(mid < L) return query(mid, r, L, R);
	if(mid > R) return query(l, mid-1, L, R);
	return S(d[L][mid-1],d[mid][R]);
}
void Init(I N, I *A){for(i=0,n=N-1;i<N;i++)a[i]=A[i],d[i][i]=a[i];Z(0,n);}I Query(I L,I R){G query(0,n,L,R);}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 20013 ms 4472 KB Time limit exceeded
2 Execution timed out 20051 ms 4556 KB Time limit exceeded
3 Execution timed out 20045 ms 4556 KB Time limit exceeded
4 Execution timed out 20021 ms 8260 KB Time limit exceeded
5 Execution timed out 20052 ms 8532 KB Time limit exceeded
6 Execution timed out 20103 ms 8532 KB Time limit exceeded
7 Execution timed out 20007 ms 8532 KB Time limit exceeded
8 Execution timed out 20086 ms 8532 KB Time limit exceeded
9 Execution timed out 20087 ms 8532 KB Time limit exceeded
10 Execution timed out 20007 ms 8552 KB Time limit exceeded