답안 #751907

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
751907 2023-06-01T18:45:16 Z Markomafko972 비밀 (JOI14_secret) C++14
0 / 100
453 ms 12204 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;

int val[1005][1005];
int sus[1005][1005];

void rek(int l, int r) {
	if (l >= r) return;
	
	int mid = (l+r)/2;
	for (int i = l; i <= mid; i++) {
		for (int j = mid+1; j <= r; j++) {
			sus[i][j] = mid;
		}
	}
	
	for (int j = mid-1; j >= l; j--) {
		val[j][mid] = Secret(val[j+1][mid], val[j][j]);
	}
	for (int j = mid+2; j <= r; j++) {
		val[mid+1][j] = Secret(val[mid+1][j-1], val[j][j]);
	}
 
	rek(l, mid);
	rek(mid+1, r);
}
 
void Init(int N, int A[]) {
	memset(val, -1, sizeof val);
	for (int i = 0; i < N; i++) {
		val[i][i] = A[i];
	}
	rek(0, N-1);
}
 
int Query(int l, int r) {
	if (val[l][r] != -1) return val[l][r];
	return Secret(val[l][sus[l][r]], val[sus[l][r]+1][r]);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 119 ms 8304 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 538256673.
2 Incorrect 121 ms 8236 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 117 ms 8340 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 435 ms 12048 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 442 ms 12100 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 435 ms 12196 KB Wrong Answer: Query(653, 654) - expected : 227441904, actual : 93182529.
7 Incorrect 453 ms 12204 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 440 ms 12100 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 440 ms 12132 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 438 ms 12188 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.