Submission #1068949

# Submission time Handle Problem Language Result Execution time Memory
1068949 2024-08-21T13:42:02 Z Luvidi Secret (JOI14_secret) C++17
30 / 100
355 ms 4432 KB
#include "secret.h"

const int maxn=1000;
int *a,n,seg[4*maxn+31];

int build(int v,int l,int r){
    if(l==r)return seg[v]=a[l];
    int m=(l+r)/2;
    return seg[v]=Secret(build(2*v+1,l,m),build(2*v+2,m+1,r));
}

int query(int v,int l,int r,int l2,int r2){
    if(l>r2||r<l2)return -1;
    if(l2<=l&&r<=r2)return seg[v];
    int m=(l+r)/2;
    int x=query(2*v+1,l,m,l2,r2),y=query(2*v+2,m+1,r,l2,r2);
    if(x==-1)return y;
    if(y==-1)return x;
    return Secret(x,y);
}

void Init(int N, int A[]) {
    n=N;
    a=A;
    build(0,0,n-1);
}

int Query(int l, int r) {
    return query(0,0,n-1,l,r);
}
# Verdict Execution time Memory Grader output
1 Partially correct 114 ms 3664 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 117 ms 2388 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 116 ms 2580 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 342 ms 4408 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 347 ms 4432 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 313 ms 4432 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 355 ms 4244 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 352 ms 4432 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 352 ms 4432 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 350 ms 4368 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16