Submission #68481

# Submission time Handle Problem Language Result Execution time Memory
68481 2018-08-17T08:08:57 Z losmi247 Secret (JOI14_secret) C++14
0 / 100
812 ms 4684 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 0;
    }
    if(l <= i && r >= j){
        return drvo[node];
    }
    int mid = i+(j-i)/2;
    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 180 ms 2372 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 34031537.
2 Incorrect 177 ms 2632 KB Wrong Answer: Query(102, 157) - expected : 32612619, actual : 569483529.
3 Incorrect 210 ms 2632 KB Wrong Answer: Query(67, 224) - expected : 202440844, actual : 739311628.
4 Incorrect 611 ms 4536 KB Wrong Answer: Query(727, 872) - expected : 870334875, actual : 870334619.
5 Incorrect 645 ms 4536 KB Wrong Answer: Query(761, 790) - expected : 112945480, actual : 112871752.
6 Incorrect 632 ms 4536 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 278446241.
7 Incorrect 812 ms 4536 KB Output isn't correct - number of calls to Secret by Init = 9976, maximum number of calls to Secret by Query = 19
8 Incorrect 790 ms 4564 KB Output isn't correct - number of calls to Secret by Init = 9976, maximum number of calls to Secret by Query = 19
9 Incorrect 788 ms 4564 KB Output isn't correct - number of calls to Secret by Init = 9976, maximum number of calls to Secret by Query = 19
10 Incorrect 764 ms 4684 KB Output isn't correct - number of calls to Secret by Init = 9976, maximum number of calls to Secret by Query = 19