답안 #751462

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
751462 2023-05-31T15:32:14 Z jmyszka2007 비밀 (JOI14_secret) C++17
0 / 100
468 ms 8376 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
int res[1010][1010];
int tab[1010];
int N;
void cnt(int l, int r) {
	if(l > r) {
		return;
	}
	if(l == r) {
		res[l][l] = tab[l];
		return;
	}
	int mid = (l + r) / 2;
	res[mid][mid] = tab[mid];
	res[mid][mid - 1] = tab[mid - 1];
	for(int i = mid - 2; i >= l; i--) {
		res[mid][i] = Secret(res[mid][i + 1], tab[i]);
	}
	for(int i = mid + 1; i <= r; i++) {
		res[mid][i] = Secret(res[mid][i - 1], tab[i]);
	}
	cnt(l, mid - 1);
	cnt(mid + 1, r);
}
void Init(int n, int a[]) {
	N = n;
	for(int i = 0; i < n; i++) {
		tab[i] = a[i];
	}
	cnt(0, n - 1);
}
int rek(int l, int r, int L, int R) {
	if(l == r) {
		return tab[l];
	}
	int mid = (L + R) / 2;
	if(l <= mid && mid <= r) {
		return Secret(res[mid][l], res[mid][r]);
	}
	if(l > mid) {
		return rek(l, r, mid + 1, R);
	}
	return rek(l, r, L, mid - 1);
}
int Query(int l, int r) {
	return rek(l, r, 0, N - 1);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 118 ms 4476 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 50471211.
2 Incorrect 122 ms 4388 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 29530216.
3 Incorrect 120 ms 4496 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 162768982.
4 Incorrect 431 ms 8284 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 858309235.
5 Incorrect 446 ms 8300 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 602966360.
6 Incorrect 431 ms 8352 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 313045306.
7 Incorrect 468 ms 8252 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 578359305.
8 Incorrect 449 ms 8236 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 633393600.
9 Incorrect 458 ms 8376 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 148126725.
10 Incorrect 442 ms 8200 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 275769990.