Submission #637131

# Submission time Handle Problem Language Result Execution time Memory
637131 2022-08-31T15:59:41 Z Blobo2_Blobo2 Secret (JOI14_secret) C++17
30 / 100
534 ms 4472 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
int seg[4000],n,arr[1000],cnt=0;
void update(int idx=1,int l=0,int r = n-1){

	if(l == r){
		seg[idx] = arr[l];
		return;
	}
	int mid = (l+r)>>1;
	update(idx<<1,mid+1,r);
	update(idx<<1|1,l,mid);
	seg[idx] = Secret(seg[idx<<1|1], seg[idx<<1]);
	//cout<<l<<' '<<r<<' '<<seg[idx<<1]<<' '<<seg[idx<<1|1]<<' '<<seg[idx]<<endl;
}
int query(int L,int R,int idx=1,int l=0,int r=n-1){
	if(l >= L && r <= R)return seg[idx];
	if(r < L || l > R)return -1;
	int mid = (l+r)>>1;
	int first = query(L,R,idx<<1,mid+1,r);
	int second = query(L,R,idx<<1|1,l,mid);
	if(first != -1 && second != -1){
		cnt++;
		return Secret(second,first);
	}
	else if(first != -1)
		return first;
	else if(second != -1)
		return second;
	else return -1;
}
void Init(int N,int A[]){
	n = N;
	for(int i=0;i<n;i++)arr[i] = A[i];
	update();

}

int Query(int l,int r){
	return query(l,r);
}
# Verdict Execution time Memory Grader output
1 Partially correct 171 ms 2380 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 164 ms 2476 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 171 ms 2460 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 487 ms 4264 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 487 ms 4272 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 436 ms 4288 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 515 ms 4472 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 516 ms 4200 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 505 ms 4240 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 534 ms 4364 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16