Submission #720296

# Submission time Handle Problem Language Result Execution time Memory
720296 2023-04-07T21:43:31 Z swagchicken Secret (JOI14_secret) C++14
0 / 100
423 ms 8300 KB
#include "secret.h"

int n;
int pre[1010][1010] = {};

void process(int L, int R, int A[]) {
    if(L == R) return;

    int m = (L + R)/2;

    pre[m][m] = A[m];
    pre[m+1][m+1] = A[m+1];
    int curr = pre[m][m];
    for(int i = m-1; i >= L; i--) {
        pre[m][i] = Secret(A[i], pre[m][i+1]);
    }
    curr = pre[m+1][m+1];
    for(int i = m+2; i <= R; i++) {
        pre[m][i] = Secret(pre[m][i-1], A[i]);
    }
    process(L, m, A);
    process(m+1, R, A);
}   

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

int Query(int L, int R) {

    int lo = 0, hi = n-1;

    while(lo < hi) {
        int mid = (lo + hi)/2;
        if(L <= mid && R >= mid + 1) {
            return Secret(pre[L][mid], pre[mid+1][R]);
        } else if(R == mid) {
            return pre[L][mid];
        }

        if(R < mid + 1) {
            hi = mid;
        } else {
            lo = mid + 1;
        }
    }

    return pre[lo][lo];

}

Compilation message

secret.cpp: In function 'void process(int, int, int*)':
secret.cpp:13:9: warning: variable 'curr' set but not used [-Wunused-but-set-variable]
   13 |     int curr = pre[m][m];
      |         ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 112 ms 4392 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 536870912.
2 Incorrect 112 ms 4264 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 0.
3 Incorrect 112 ms 4388 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 536870912.
4 Incorrect 414 ms 8180 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 536870912.
5 Incorrect 423 ms 8184 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 536870912.
6 Incorrect 422 ms 8208 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 942318537.
7 Incorrect 419 ms 8268 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 0.
8 Incorrect 422 ms 8152 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 536870912.
9 Incorrect 420 ms 8300 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 0.
10 Incorrect 420 ms 8196 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 0.