Submission #386806

# Submission time Handle Problem Language Result Execution time Memory
386806 2021-04-07T10:55:12 Z saarang123 Secret (JOI14_secret) C++17
0 / 100
526 ms 8452 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
const int mxn = 1002;
int a[mxn][mxn], n;

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

void Init(int N, int A[]) {
	n = N;
	for(int i = 0; i < n; i++) 
		for(int j = 0; j < n; j++)
			a[i][j] = (i == j ? A[i] : -1);
	fix(0, n - 1);
}

int answer(int l, int r, int ql, int qr) {
	int mid = (l + r) >> 1;
	if(ql > mid)
		return answer(mid + 1, r, ql, qr);
	else if(qr < mid)
		return answer(l, mid, ql, qr);
	return Secret(a[ql][mid], a[mid + 1][qr]);
}

int Query(int L, int R) {
	return answer(0, n - 1, L, R);
}
# Verdict Execution time Memory Grader output
1 Incorrect 143 ms 4460 KB Wrong Answer [1]
2 Incorrect 133 ms 4460 KB Wrong Answer [1]
3 Incorrect 134 ms 4460 KB Wrong Answer [1]
4 Incorrect 500 ms 8428 KB Wrong Answer [1]
5 Incorrect 513 ms 8300 KB Wrong Answer [1]
6 Incorrect 526 ms 8452 KB Wrong Answer [1]
7 Incorrect 509 ms 8300 KB Wrong Answer [1]
8 Incorrect 503 ms 8320 KB Wrong Answer [1]
9 Incorrect 506 ms 8300 KB Wrong Answer [1]
10 Incorrect 510 ms 8416 KB Wrong Answer [1]