Submission #70222

# Submission time Handle Problem Language Result Execution time Memory
70222 2018-08-22T13:45:22 Z MladenP Secret (JOI14_secret) C++17
0 / 100
705 ms 8696 KB
#include <bits/stdc++.h>
#include "secret.h"
#define mid (l+r)/2
using namespace std;
#define MAXN 1010
int n, a[MAXN], d[MAXN][MAXN];
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 = 1; i <= n; i++) a[i] = A[i-1];
	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) {
	L++; R++;
	if(L+1 == R) return Secret(a[L], a[R]);
	return query(1, n, L+1, R+1);
}

Compilation message

secret.cpp: In function 'int query(int, int, int, int)':
secret.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Incorrect 179 ms 4472 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 307655478.
2 Incorrect 163 ms 4480 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 539081064.
3 Incorrect 164 ms 4532 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 355475528.
4 Incorrect 651 ms 8472 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 569475659.
5 Incorrect 645 ms 8476 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 987791438.
6 Incorrect 649 ms 8640 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 206870645.
7 Incorrect 651 ms 8696 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 785056803.
8 Incorrect 686 ms 8696 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 560296976.
9 Incorrect 670 ms 8696 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 299376775.
10 Incorrect 705 ms 8696 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 4663113.