Submission #52550

# Submission time Handle Problem Language Result Execution time Memory
52550 2018-06-26T07:07:00 Z suzy Secret (JOI14_secret) C++14
0 / 100
4635 ms 655360 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 + 1 == 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 583 ms 10600 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 559309193.
2 Incorrect 537 ms 10628 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 533 ms 10748 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 145096996.
4 Incorrect 2185 ms 35788 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 327860453.
5 Incorrect 2195 ms 36008 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Runtime error 4635 ms 655360 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Incorrect 2162 ms 655360 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 2138 ms 655360 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 2297 ms 655360 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 2361 ms 655360 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.