Submission #961178

# Submission time Handle Problem Language Result Execution time Memory
961178 2024-04-11T15:58:40 Z ByeWorld Secret (JOI14_secret) C++14
30 / 100
452 ms 4504 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];

struct seg {
	int st[4*MAXN];
	void bd(int id, int l, int r){
		if(l==r){
			st[id] = a[l]; return;
		}
		bd(lf, l, md); bd(rg, md+1, r);
		st[id] = Secret(st[lf], st[rg]);
	}
	int que(int id, int l, int r, int x, int y){
		if(x<=l && r<=y) return st[id];
		if(r<x || y<l) return -1;
		int le = que(lf, l, md, x, y), ri = que(rg, md+1, r, x, y);
		if(le==-1) return ri;
		else if(ri==-1) return le;
		else {
			return Secret(le, ri);
		}
	}
} A;

void Init(int N, int x[]) {
	n = N;
	for(int i=0; i<n; i++) a[i+1] = x[i];
	A.bd(1, 1, n);
}

int Query(int L, int R) {
	L++; R++;
	return A.que(1, 1, n, L, R);
}
# Verdict Execution time Memory Grader output
1 Partially correct 143 ms 2896 KB Output is partially correct - number of calls to Secret by Init = 510, maximum number of calls to Secret by Query = 13
2 Partially correct 150 ms 2792 KB Output is partially correct - number of calls to Secret by Init = 511, maximum number of calls to Secret by Query = 14
3 Partially correct 143 ms 2808 KB Output is partially correct - number of calls to Secret by Init = 512, maximum number of calls to Secret by Query = 15
4 Partially correct 425 ms 4436 KB Output is partially correct - number of calls to Secret by Init = 998, maximum number of calls to Secret by Query = 15
5 Partially correct 421 ms 4436 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 15
6 Partially correct 386 ms 4348 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 4
7 Partially correct 452 ms 4500 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16
8 Partially correct 444 ms 4392 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16
9 Partially correct 442 ms 4504 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16
10 Partially correct 442 ms 4500 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16