Submission #481461

# Submission time Handle Problem Language Result Execution time Memory
481461 2021-10-21T01:47:51 Z jhhope1 Secret (JOI14_secret) C++14
0 / 100
455 ms 4520 KB
#include<bits/stdc++.h>
#include<secret.h>
const int MAXN = 1010;
int n;
int orig[MAXN];
int V[12][MAXN];
void build(int s, int e, int v, int dep){
    if(s==e){
        V[dep][s] = orig[s];
        return;
    }
    int m = (s+e)>>1;
    build(s, m, v*2, dep+1);
    build(m+1, e, v*2+1, dep+1);
    V[dep][m] = orig[m];
    V[dep][m+1] = orig[m+1];
    for(int i=m-1 ; i>=s ; i--){
        V[dep][i] = Secret(orig[i], V[dep][i+1]);
    }
    for(int i=m+1 ; i<=e ; i++){
        V[dep][i] = Secret(orig[i], V[dep][i-1]);
    }

}
void Init(int N, int A[]){
    for(int i=0 ; i<N ; i++){
        orig[i] = A[i];
    }
    n = N;
    build(0, N-1, 1, 0);
    return ;
}
int eval(int s, int e, int l, int r, int dep){
    if(s==e){
        return orig[s];
    }
    int m = (s+e)>>1;
    if(l<=m && m+1<=r){
        return Secret(V[dep][l], V[dep][r]);
    }
    if(r==m){
        return V[dep][l];
    }
    if(l==m+1){
        return V[dep][r];
    }
    if(l>m+1){
        return eval(m+1, e, l, r, dep+1);
    }
    if(r<m){
        return eval(s, m, l, r, dep+1);
    }
}
int Query(int L, int R){
    return eval(0, n-1, L, R, 0);
}

Compilation message

secret.cpp: In function 'int eval(int, int, int, int, int)':
secret.cpp:53:1: warning: control reaches end of non-void function [-Wreturn-type]
   53 | }
      | ^
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 2396 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 822244391.
2 Incorrect 116 ms 2452 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 179341377.
3 Incorrect 123 ms 2480 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 681674848.
4 Incorrect 428 ms 4520 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 290587207.
5 Incorrect 447 ms 4376 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 907575628.
6 Incorrect 455 ms 4316 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 321866539.
7 Incorrect 453 ms 4376 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 124256330.
8 Incorrect 420 ms 4352 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 431038472.
9 Incorrect 432 ms 4352 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 679881604.
10 Incorrect 429 ms 4340 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 543009546.