답안 #946441

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946441 2024-03-14T16:31:10 Z NintsiChkhaidze 비밀 (JOI14_secret) C++17
0 / 100
375 ms 8528 KB
#include "secret.h"
int val[1003][1003],arr[1003],n;

void dnq(int l,int r){
	if (l == r) return;
	
	int mid = (l + r)/2;
	for (int i = mid + 2; i <= r; i++)
		val[mid + 1][i] = Secret(val[mid + 1][i - 1],arr[i]);
		
	for (int i = mid - 1; i >= l; i--)
		val[i][mid] = Secret(val[i + 1][mid],arr[i]);
		
	dnq(l,mid);
	dnq(mid + 1,r);
}
void Init(int N, int A[]) {
	n = N;
	for (int i = 0; i < N; i++){
		val[i][i] = A[i];
		arr[i] = A[i];
	}
  	dnq(0,N - 1);
}

int Query(int L, int R) {
	if (L == R) return val[L][L];
	
  	int l = 0,r = n - 1;
  	while (1){
	  	int mid = (l + r)/2;
	  	if (L <= mid && mid < R) 
	  		return Secret(val[L][mid],val[mid + 1][R]);	
		
		if (R <= mid){
			r = mid;
		}else{
			l = mid + 1;
		}
  	}
  	
  	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 100 ms 7904 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 538256673.
2 Incorrect 94 ms 7640 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 96 ms 7768 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 350 ms 8416 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 348 ms 8276 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 375 ms 8528 KB Wrong Answer: Query(747, 749) - expected : 244228265, actual : 935077363.
7 Incorrect 348 ms 8196 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 350 ms 8408 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 351 ms 8404 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 355 ms 8276 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.