Submission #751903

# Submission time Handle Problem Language Result Execution time Memory
751903 2023-06-01T18:35:06 Z Markomafko972 Secret (JOI14_secret) C++14
0 / 100
482 ms 8424 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;
 
void rek(int l, int r) {
	if (l >= r) return;
	if (l+1 == r) {
		val[l][r] = Secret(val[l][l], val[r][r]);
		return;
	}
	
	int mid = (l+r)/2;
	for (int j = mid-1; j >= l; j--) {
		if (kol == 8000) assert(0);
		val[j][mid] = Secret(val[j+1][mid], a[j]);
		kol++;
	}
	for (int j = mid+2; j <= r; j++) {
		if (kol == 8000) assert(0);
		val[mid+1][j] = Secret(val[mid+1][j-1], a[j]);
		kol++;
	}
 
	rek(l, mid);
	rek(mid+1, 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-1);
}
 
int Query(int l, int r) {
	if (val[l][r] != -1) return val[l][r];
	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;
}
# Verdict Execution time Memory Grader output
1 Incorrect 136 ms 6544 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 538256673.
2 Incorrect 114 ms 6428 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 117 ms 6344 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 454 ms 8392 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 482 ms 8276 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 465 ms 8312 KB Wrong Answer: Query(811, 813) - expected : 25091616, actual : 678362320.
7 Incorrect 433 ms 8336 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 480 ms 8300 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 451 ms 8424 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 426 ms 8232 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.