Submission #70269

# Submission time Handle Problem Language Result Execution time Memory
70269 2018-08-22T14:25:30 Z MladenP Secret (JOI14_secret) C++17
0 / 100
688 ms 8552 KB
#include "secret.h"
#define mid (l+r)/2
int n, a[1010], d[1010][1010];
void init(int l, int r) {
	if(l >= r) return;
	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], d[i][i] = a[i];
	init(1, N);
}
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(1, n, L, R);
}

Compilation message

secret.cpp: In function 'int query(int, int, int, int)':
secret.cpp:22:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Incorrect 173 ms 4472 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 22166791.
2 Incorrect 174 ms 4500 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 306225408.
3 Incorrect 178 ms 4676 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 629483540.
4 Incorrect 651 ms 8408 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 34079308.
5 Incorrect 688 ms 8436 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 542818560.
6 Incorrect 596 ms 8436 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 579799611.
7 Incorrect 650 ms 8456 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 772352096.
8 Incorrect 623 ms 8456 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 290455552.
9 Incorrect 622 ms 8460 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 164632041.
10 Incorrect 632 ms 8552 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 872638089.