Submission #68485

# Submission time Handle Problem Language Result Execution time Memory
68485 2018-08-17T08:11:55 Z losmi247 Secret (JOI14_secret) C++14
6 / 100
1529 ms 4656 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
int Q,l,r;
int drvo[2000005];
int n,a[2000005];
void update(int i,int j,int poz,int val,int node){
    if(i == j){
        drvo[node] = val;
        return;
    }
    int mid = i+(j-i)/2;
    if(poz <= mid){
        update(i,mid,poz,val,2*node+1);
    }
    else{
        update(mid+1,j,poz,val,2*node+2);
    }
    drvo[node] = Secret(drvo[2*node+1],drvo[2*node+2]);
}
int get(int i,int j,int l,int r,int node){
    if(j < l || i > r){
        return -1;
    }
    if(l <= i && r >= j){
        return drvo[node];
    }
    int mid = i+(j-i)/2;
    int p1 = get(i,mid,l,r,2*node+1),p2=get(mid+1,j,l,r,2*node+2);
    if(p1 == -1){
        return p2;
    }
    else if(p2 == -1){
        return p1;
    }
    else{
        return Secret(get(i,mid,l,r,2*node+1),get(mid+1,j,l,r,2*node+2));
    }
}
int Query(int L,int R){
    return get(0,n-1,L,R,0);
}
void Init(int N,int A[]){
    n = N;
    for(int i = 0; i < N; i++){
        update(0,n-1,i,A[i],0);
        a[i] = A[i];
    }
    cin >> Q;
    while(Q--){
        cin >> l >> r;
        cout << Query(l,r) << endl;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 407 ms 2476 KB Output isn't correct - number of calls to Secret by Init = 4598, maximum number of calls to Secret by Query = 317
2 Incorrect 414 ms 2524 KB Output isn't correct - number of calls to Secret by Init = 4608, maximum number of calls to Secret by Query = 381
3 Incorrect 414 ms 2524 KB Output isn't correct - number of calls to Secret by Init = 4619, maximum number of calls to Secret by Query = 637
4 Incorrect 986 ms 4656 KB Output isn't correct - number of calls to Secret by Init = 9965, maximum number of calls to Secret by Query = 637
5 Incorrect 975 ms 4656 KB Output isn't correct - number of calls to Secret by Init = 9976, maximum number of calls to Secret by Query = 573
6 Incorrect 637 ms 4656 KB Output isn't correct - number of calls to Secret by Init = 9976, maximum number of calls to Secret by Query = 9
7 Incorrect 1529 ms 4656 KB Output isn't correct - number of calls to Secret by Init = 9976, maximum number of calls to Secret by Query = 765
8 Incorrect 1447 ms 4656 KB Output isn't correct - number of calls to Secret by Init = 9976, maximum number of calls to Secret by Query = 765
9 Incorrect 1479 ms 4656 KB Output isn't correct - number of calls to Secret by Init = 9976, maximum number of calls to Secret by Query = 765
10 Incorrect 1415 ms 4656 KB Output isn't correct - number of calls to Secret by Init = 9976, maximum number of calls to Secret by Query = 765