답안 #704612

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
704612 2023-03-02T12:25:24 Z dubabuba 비밀 (JOI14_secret) C++14
0 / 100
439 ms 8372 KB
#include "secret.h"

const int mxn = 1010;
int range[mxn][mxn];
int n, a[mxn];

int build(int l, int r, int a[]) {
	if(l == r) return range[l][r] = a[l];
	if(l == r - 1) return range[l][r] = Secret(a[l], a[r]);

	build(l, (l + r) / 2, a);
	build((l + r) / 2 + 1, r, a);

	int m = (l + r) / 2;
	range[m][m] = a[m];
	for(int s = m - 1; s >= l; s--)
		range[s][m] = Secret(a[s], range[s + 1][m]);

	m++;
	range[m][m] = a[m];
	for(int e = m + 1; e <= r; e++)
		range[m][e] = Secret(range[m][e - 1], a[e]);

	return 0;
}

void Init(int N, int A[]) {
	build(0, N - 1, A);
	n = N;
}

int Query(int L, int R) {
	int l = 0, r = n - 1;
	while(r - l > 1) {
		int m = (l + r) / 2;

		if(L == m) return range[L][R];
		if(R == m) return range[L][R];
		if(L <= m && m < R) return Secret(range[L][m], range[m + 1][R]);
		if(m < L) l = m;
		else r = m + 1;
	}
	return range[L][R];
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 114 ms 4456 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 536870912.
2 Incorrect 111 ms 4312 KB Wrong Answer: Query(102, 157) - expected : 32612619, actual : 0.
3 Incorrect 114 ms 4332 KB Wrong Answer: Query(128, 153) - expected : 959658850, actual : 0.
4 Incorrect 419 ms 8240 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 536870912.
5 Incorrect 417 ms 8140 KB Wrong Answer: Query(263, 292) - expected : 653448456, actual : 536870912.
6 Incorrect 419 ms 8372 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 0.
7 Partially correct 424 ms 8176 KB Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1
8 Partially correct 431 ms 8220 KB Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1
9 Partially correct 439 ms 8164 KB Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1
10 Partially correct 437 ms 8200 KB Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1