답안 #574026

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
574026 2022-06-07T15:17:28 Z Vanilla 비밀 (JOI14_secret) C++17
0 / 100
461 ms 12248 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
const int maxn = 1001;
int pref [maxn][maxn];
int sg [maxn][maxn];
 
void build (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++){
            sg[i][j] = mid;
        }
    }
    for (int i = mid + 2; i <= r; i++){
		pref[mid + 1][i] = Secret(pref[i][i], pref[mid + 1][i-1]);
	}
	for (int i = mid - 1; i >= l; i--){
		pref[i][mid] = Secret(pref[i][i], pref[i + 1][mid]);
	}
	build (l, mid);
	build (mid + 1, r);
 
}
 
void Init(int N, int A[]) {
	for (int i = 0; i < N; i++){
		for (int j = 0; j < N; j++) {
			pref[i][j] = -1;
		}
	}
    for (int i = 0; i < N; i++){
		pref[i][i] = A[i];
    }
	build(0, N);
}
 
int Query(int L, int R) {
	if (pref[L][R] != -1) return pref[L][R];
	int mid = sg[L][R];
	return Secret(pref[L][mid], pref[mid + 1][R]);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 118 ms 6380 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 554110774.
2 Incorrect 119 ms 6440 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 611354816.
3 Incorrect 118 ms 6340 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820.
4 Incorrect 461 ms 12160 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 650789536.
5 Incorrect 439 ms 12248 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 16813134.
6 Incorrect 443 ms 12240 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 302576192.
7 Incorrect 438 ms 12204 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 177243257.
8 Incorrect 448 ms 12112 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 166020424.
9 Incorrect 439 ms 12160 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 416678977.
10 Incorrect 439 ms 12124 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 270861571.