Submission #487210

# Submission time Handle Problem Language Result Execution time Memory
487210 2021-11-14T19:39:08 Z AnasBenMoussa Secret (JOI14_secret) C++14
30 / 100
536 ms 4368 KB
#include <bits/stdc++.h>
#include "secret.h"

using namespace std;
long long  a[10000];
long long  tree[400000];int n;
int mer(int a,int b){
    if(a==-1){return b;}
    if(b==-1){return a;}

    return Secret(a,b);
}
void build(int v, int tl, int tr) {
    if (tl == tr) {
        tree[v] = a[tl];
    } else {
        int tm = (tl + tr) / 2;
        build( v*2, tl, tm);
        build( v*2+1, tm+1, tr);
        tree[v] = mer(tree[v*2],tree[v*2+1]);
    }
}
void Init(int N, int A[]){
    n=N;
   for(long long  i=0;i<N;i++){
        a[i]=A[i];
   }
   build(1,0,N-1);
}
int sum(int v, int tl, int tr, int l, int r) {
    if (l>r) 
        return -1 ;
    if (l == tl && r == tr) {
        return tree[v];
    }
    int tm = (tl + tr) / 2;
    return mer(sum(v*2, tl, tm, l, min(r, tm))
            ,sum(v*2+1, tm+1, tr, max(l, tm+1), r));
}


int  Query(int L , int R){
    
    return sum(1,0,n-1,L,R);
}


# Verdict Execution time Memory Grader output
1 Partially correct 160 ms 2448 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 160 ms 2312 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 161 ms 2376 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 482 ms 4368 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 486 ms 4292 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 438 ms 4280 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 536 ms 4260 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 531 ms 4240 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 498 ms 4184 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 498 ms 4304 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16