Submission #908864

# Submission time Handle Problem Language Result Execution time Memory
908864 2024-01-17T00:48:47 Z vjudge1 Secret (JOI14_secret) C++17
30 / 100
426 ms 4500 KB
#include <iostream>
#include <vector>
#include "secret.h"
using namespace std;

vector<int> v;

int segtree[10000];

void build(int l, int r, int node) {
	
	if(l == r) {
		segtree[node] = v[l];
		return;
	}
	
	int mid = (l+r)/2; 
	
	build(l, mid, node*2);
	build(mid+1, r, node*2+1);
	
	segtree[node] = Secret(segtree[node*2], segtree[node*2+1]);
}

int que(int l, int r, int tl, int tr, int node) {
	
	if(tl > r || tr < l) {
		return -1;
	}
	
	if(l <= tl && tr <= r) {
		return segtree[node];
	}
	
	int mid = (tl+tr)/2;
	
	int a, b;
	
	a = que(l, r, tl, mid, node*2);
	b = que(l, r, mid+1, tr, node*2+1);
	
	if(a == -1) {
		return b;
	}
	
	if(b == -1) {
		return a;
	}
	
	return Secret(a, b);
}

int lol;

int Query(int L, int R) {
	L++;
	R++;
	
	return que(L, R, 1, lol, 1);
}

void Init(int N, int A[]) {
	
	lol = N;
	
	v.push_back(0);
	
	for(int i=0; i<N; i++) {
		v.push_back(A[i]);
	}
	
	build(1, N, 1);
}
# Verdict Execution time Memory Grader output
1 Partially correct 139 ms 2900 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 132 ms 2640 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 133 ms 2816 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 395 ms 4360 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 393 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 363 ms 4436 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 426 ms 4432 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 416 ms 4348 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 410 ms 4340 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 421 ms 4500 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16