답안 #52546

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
52546 2018-06-26T07:01:50 Z tataky(#1353) 비밀 (JOI14_secret) C++11
0 / 100
2475 ms 35976 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);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 558 ms 10528 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 559309193.
2 Incorrect 539 ms 10796 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 550 ms 10808 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 145096996.
4 Incorrect 2357 ms 35732 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 327860453.
5 Incorrect 2475 ms 35900 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Incorrect 2284 ms 35924 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 302576192.
7 Incorrect 2175 ms 35924 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 2269 ms 35944 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 2158 ms 35956 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 2411 ms 35976 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.