답안 #859691

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
859691 2023-10-10T13:30:51 Z iskhakkutbilim 비밀 (JOI14_secret) C++17
0 / 100
637 ms 8304 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;

const int mod = 1e9;

//int Secret(int a, int b){
//	return min(a / 2 + b, mod);
//}

int range[1000][1000];
vector<int> a;
int n, ask;
void rec(int l, int r){
	if(l > r) return;
	if(l == r){
		range[l][r] = a[l];
		return;
	}
	if(r-l == 1){
		range[l][r] = Secret(a[l], a[l + 1]);
		ask++;
		return;
	}
	int mid = (l + r) >> 1;
	int oper = a[mid + 1];
	range[mid + 1][mid + 1] = oper;
	for(int i = mid+2; i <= r; i++){
		oper = Secret(oper, a[i]);
		range[mid + 1][i] = oper;
	}
	oper = a[mid];
	range[mid][mid] = oper;
	for(int i = mid; i >= l; i--){
		if(i != mid) oper = Secret(oper, a[i]);
		for(int j = mid + 1; j <= r; j++){
			range[i][j] = Secret(oper, range[mid + 1][j]);
		}
	}
	rec(l, mid);
	rec(mid + 1, r);
}

void Init(int N, int A[]){
//	Secret(0, 1000000000);
	cin >> N;
	n = N;
	for(int i = 0;i < N; i++) a.push_back(A[i]);
	rec(0, n-1);
//	cout << "Number of calling Secret is " << ask << '\n';
}

int Query(int l, int r){
	return range[l][r];
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 163 ms 6736 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 268854015.
2 Incorrect 179 ms 6752 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 163 ms 6736 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 618 ms 8276 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 622 ms 8288 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 620 ms 8304 KB Wrong Answer: Query(200, 208) - expected : 277813445, actual : 154975445.
7 Incorrect 625 ms 8272 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 611 ms 8288 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 637 ms 8272 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 623 ms 8272 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.