답안 #52555

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
52555 2018-06-26T07:10:45 Z suzy 비밀 (JOI14_secret) C++14
0 / 100
2521 ms 36096 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];
		d[ip(i, i)] = a[i];
	}
	go(0, n);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 578 ms 10756 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 574640985.
2 Incorrect 601 ms 10772 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 543 ms 10776 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 145096996.
4 Incorrect 2264 ms 35780 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 327860453.
5 Incorrect 2216 ms 35828 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Incorrect 2165 ms 35944 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 302576192.
7 Incorrect 2313 ms 36096 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 2333 ms 36096 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 2521 ms 36096 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 2366 ms 36096 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.