답안 #70270

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70270 2018-08-22T14:26:50 Z MladenP 비밀 (JOI14_secret) C++17
0 / 100
686 ms 8628 KB
#include "secret.h"
#define mid (l+r)/2
#define MAXN 1010
int n, a[1010], d[1010][1010];
void init(int l, int r) {
	if(l >= r) return;
	for(int i = 0; i < n; i++) d[i][i] = a[i];
	for(int i = mid+1; i <= r; i++) d[mid][i] = Secret(d[mid][i-1], a[i]);
	for(int 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[]) {
	n = N;
	for(int i = 0; i < n; i++) a[i] = A[i-1];
	init(0, N-1);
}
int query(int l, int r, int L, int R) {
	if(L <= mid && mid <= R) {
		if(L < mid) return Secret(d[L][mid-1],d[mid][R]);
		else return d[mid][R];
	}
	if(mid < L) return query(mid+1, r, L, R);
	if(R < mid) return query(l, mid-1, L, R);
}
int Query(int L, int R) {
	if(L == R) return a[L];
	if(L+1 == R) return Secret(a[L], a[R]);
	return query(0, n-1, L, R);
}

Compilation message

secret.cpp: In function 'int query(int, int, int, int)':
secret.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 177 ms 4616 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 22166791.
2 Incorrect 174 ms 4616 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 306225408.
3 Incorrect 174 ms 4616 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 629483540.
4 Incorrect 632 ms 8628 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 34079308.
5 Incorrect 627 ms 8628 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 542818560.
6 Incorrect 657 ms 8628 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 579799611.
7 Incorrect 649 ms 8628 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 772352096.
8 Incorrect 599 ms 8628 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 290455552.
9 Incorrect 686 ms 8628 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 164632041.
10 Incorrect 603 ms 8628 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 872638089.