Submission #961383

# Submission time Handle Problem Language Result Execution time Memory
961383 2024-04-12T03:00:12 Z ByeWorld Secret (JOI14_secret) C++14
0 / 100
391 ms 5096 KB
#include "secret.h"
#include <bits/stdc++.h>
#include <random>
#define ll long long
// #define int long long
#define fi first
#define se second
#define pb push_back
#define md ((l+r)>>1)
#define lf (id<<1)
#define rg ((id<<1)|1)
#define ld long double
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,pii> ipii;
const int MAXN = 1e3+10;
const int MAXA = 1e6+10;
const int INF = 2e9+10;
const int LOG = 30;
const int MOD = 1e9+7;

int n;
int a[MAXN], dep[MAXN];
map <pii, int> m;

void bd(int DEP, int l, int r){
	if(l>r) return;
	// cout << DEP << ' ' << l << ' ' << r << " pp\n";
	int mid = md;
	dep[mid] = DEP;
	if(l==r) return;

	int val = a[mid];
	for(int i=mid-1; i>=l; i--){
		val = Secret(a[i], val); // ke kiri
		m[pii(i, mid)] = val;
	}
	val = a[mid+1];
	for(int i=mid+2; i<=r; i++){
		val = Secret(val, a[i]); // ke kanan
		m[pii(mid+1, i)] = val;
	}
	bd(DEP+1, l, mid-1); bd(DEP+1, mid+1, r);
}

void Init(int N, int x[]) {
	n = N;
	for(int i=0; i<n; i++){
		a[i+1] = x[i]; m[pii(i+1, i+1)] = x[i];
	}
	bd(1, 1, n);
	for(int i=1; i<=n; i++) cout << dep[i] << " \n"[i==n];
}

int Query(int L, int R) {
	L++; R++;
	int idx = -1, mn = INF;
	for(int i=L; i<=R; i++){
		if(mn > dep[i]){
			idx = i;
			mn = dep[i];
		}
	}
	return Secret(m[pii(L, idx)], m[pii(idx+1, R)]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 98 ms 2900 KB Do not print anything to standard output
2 Incorrect 100 ms 2804 KB Do not print anything to standard output
3 Incorrect 106 ms 2808 KB Do not print anything to standard output
4 Incorrect 366 ms 4908 KB Do not print anything to standard output
5 Incorrect 372 ms 4892 KB Do not print anything to standard output
6 Incorrect 368 ms 4948 KB Do not print anything to standard output
7 Incorrect 389 ms 4936 KB Do not print anything to standard output
8 Incorrect 386 ms 4852 KB Do not print anything to standard output
9 Incorrect 388 ms 5096 KB Do not print anything to standard output
10 Incorrect 391 ms 4944 KB Do not print anything to standard output