Submission #52551

# Submission time Handle Problem Language Result Execution time Memory
52551 2018-06-26T07:07:57 Z suzy Secret (JOI14_secret) C++14
0 / 100
2431 ms 35856 KB
#include "secret.h"
#include <map>
#include <utility>

using namespace std;

typedef pair<int, int> ip;

int a[1001], n;
map<ip, int> d;

int qry(int l, int r, int L, int R) {
	if (L == R) return a[L];
	int mid = (l + r) / 2;
	if (R < mid) return qry(l, mid, L, R);
	else if (L >= mid) return qry(mid, r, L, R);
	else return Secret(d[ip(L, mid - 1)], d[ip(mid, R)]);
}

int Query(int L, int R) {
	return qry(0, n, L, R);
}

void go(int l, int r) {
	if (l + 1 == r) return;
	int mid = (l + r) / 2;
	int cur = a[mid - 1];
	for (int i = mid - 2; i >= 0; i--) {
		cur = Secret(cur, a[i]);
		d[ip(i, mid - 1)] = cur;
	}
	cur = a[mid];
	for (int i = mid + 1; i < n; i++) {
		cur = Secret(cur, a[i]);
		d[ip(mid, i)] = cur;
	}
	go(l, mid);
	go(mid, r);
}

void Init(int N, int A[]) {
	n = N;
	for (int i = 0; i < n; i++)
		a[i] = A[i];
	go(0, n);
}
# Verdict Execution time Memory Grader output
1 Incorrect 561 ms 10648 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 559309193.
2 Incorrect 591 ms 10784 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 529 ms 10784 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 145096996.
4 Incorrect 2088 ms 35848 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 327860453.
5 Incorrect 2310 ms 35848 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Incorrect 2159 ms 35848 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 302576192.
7 Incorrect 2204 ms 35852 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 2116 ms 35852 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 2402 ms 35852 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 2431 ms 35856 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.