답안 #747860

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
747860 2023-05-24T23:42:34 Z Markomafko972 비밀 (JOI14_secret) C++17
0 / 100
441 ms 8400 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
 
int n;
int a[1005];
int val[1005][1005];
vector<int> v[1005];
int kol = 0;
 
// 4: 0 1 2 3 
 
void rek(int l, int r) {
	if (l+1 == r) {
		val[l][l] = a[l];
		return;
	}
	
	int mid = (l+r)/2;
	int tren = a[mid-1];
	for (int j = mid-2; j >= l; j--) {
		if (kol == 8000) assert(0);
		tren = Secret(tren, a[j]);
		kol++;
		if (tren > 1e9) assert(0);
		val[j][mid-1] = tren;
	}
	tren = a[mid];
	for (int j = mid+1; j < r; j++) {
		if (kol == 8000) assert(0);
		tren = Secret(tren, a[j]);
		kol++;
		if (tren > 1e9) assert(0);
		val[mid][j] = tren;
	}
 
	rek(l, mid);
	rek(mid, r);
}
 
void Init(int N, int A[]) {
	n = N;
	memset(val, -1, sizeof val);
	for (int i = 0; i < n; i++) {
		a[i] = A[i];
		val[i][i] = a[i];
	}
	rek(0, n);
}
 
int Query(int l, int r) {
	if (l == r) return a[l];
	for (int i = l; i < r; i++) {
		if (val[l][i] != -1 && val[i+1][r] != -1) return Secret(val[l][i], val[i+1][r]);
	}
	return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 119 ms 6464 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 50471211.
2 Incorrect 123 ms 6428 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 124 ms 6376 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 162768982.
4 Incorrect 424 ms 8368 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 858309235.
5 Incorrect 438 ms 8332 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 441 ms 8388 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 61461050.
7 Incorrect 431 ms 8400 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 435 ms 8300 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 427 ms 8352 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 427 ms 8308 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.