답안 #93523

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
93523 2019-01-09T10:34:44 Z Dat160601 비밀 (JOI14_secret) C++14
0 / 100
495 ms 8468 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int n, val[1007][1007], a[1007];

void prep(int l, int r){
	if(l == r){
		val[l][l] = a[l - 1];
		return;
	}
	int mid = (l + r) >> 1;
	for(int i = mid; i >= l; i--){
		if(i == mid) val[i][mid] = a[mid - 1];
		else val[i][mid] = Secret(val[i + 1][mid], a[i - 1]);
	}
	for(int i = mid + 1; i <= r; i++){
		if(i == mid + 1) val[mid + 1][i] = a[mid];
		else val[mid + 1][i] = Secret(val[mid + 1][i - 1], a[i - 1]);
	}
	prep(l, mid);
	prep(mid + 1, r);
}

void Init(int N, int A[]){
	n = N;
	for(int i = 0; i < n; i++) a[i] = A[i];
	prep(1, N);
}

int solve(int l, int r, int L, int R){
	if(L == R) return a[L - 1];
	int mid = (l + r) >> 1;
	if(L <= mid && R > mid) return Secret(val[L][mid], val[mid + 1][R]);
	if(R <= mid) return solve(l, mid, L, R);
	else return solve(mid + 1, r, L, R);
}

int Query(int L, int R){
	return solve(1, n, L + 1, R + 1);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 134 ms 4600 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 538256673.
2 Incorrect 133 ms 4472 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 133 ms 4600 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 490 ms 8280 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 487 ms 8276 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 488 ms 8468 KB Wrong Answer: Query(747, 749) - expected : 244228265, actual : 935077363.
7 Incorrect 492 ms 8452 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 486 ms 8372 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 495 ms 8440 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 495 ms 8436 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.