답안 #70277

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70277 2018-08-22T14:36:07 Z MladenP 비밀 (JOI14_secret) C++17
100 / 100
733 ms 8660 KB
#include <bits/stdc++.h>
#include "secret.h"
#define mid (l+r)/2
using namespace std;
int n, i, a[1010], d[1010][1010];
void init(int l, int r) {
	if(l >= r) return;
	for(i = mid+1; i <= r; i++) d[mid][i] = Secret(d[mid][i-1], a[i]);
	for(i = mid-2; i >= l; i--) d[i][mid-1] = Secret(a[i], d[i+1][mid-1]);
	init(l, mid-1);init(mid+1, r);
}
void Init(int N, int *A) {
	for(i = 0, n = N; i < n; i++) a[i] = A[i], d[i][i] = a[i];
	init(0, N-1);
}
int query(int l, int r, int L, int R) {
	if(L < mid && mid <= R) return Secret(d[L][mid-1],d[mid][R]);
	if(L == mid) return d[mid][R];
	if(mid < L) return query(mid+1, r, L, R);
	return query(l, mid-1, L, R);
}
int Query(int L, int R) {
	//if(L == R) return a[L];
	return query(0, n-1, L, R);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 192 ms 4440 KB Output is correct - number of calls to Secret by Init = 3331, maximum number of calls to Secret by Query = 1
2 Correct 208 ms 4444 KB Output is correct - number of calls to Secret by Init = 3340, maximum number of calls to Secret by Query = 1
3 Correct 200 ms 4640 KB Output is correct - number of calls to Secret by Init = 3349, maximum number of calls to Secret by Query = 1
4 Correct 684 ms 8512 KB Output is correct - number of calls to Secret by Init = 7491, maximum number of calls to Secret by Query = 1
5 Correct 663 ms 8536 KB Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1
6 Correct 620 ms 8536 KB Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1
7 Correct 664 ms 8660 KB Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1
8 Correct 644 ms 8660 KB Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1
9 Correct 654 ms 8660 KB Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1
10 Correct 733 ms 8660 KB Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1