Submission #865999

# Submission time Handle Problem Language Result Execution time Memory
865999 2023-10-25T09:25:40 Z lolismek Secret (JOI14_secret) C++14
0 / 100
388 ms 4608 KB
#include "secret.h"

#include <vector>
#include <iostream>

using namespace std;


const int NMAX = 1000;

int n;
int a[NMAX + 1];
int dp[10][NMAX + 1];

void divide(int level, int l, int r){
    if(l == r){
        dp[level][l] = a[l];
        return;
    }

    int mid = (l + r) / 2;

    dp[level][mid] = a[mid];
    for(int i = mid - 1; i >= l; i--){
        dp[level][i] = Secret(a[i], dp[level][i + 1]);
    }
    dp[level][mid + 1] = a[mid + 1];
    for(int i = mid + 2; i <= r; i++){
        dp[level][i] = Secret(dp[level][i - 1], a[i]);
    }

    divide(level + 1, l, mid);
    divide(level + 1, mid + 1, r);
}

void Init(int N, int A[]){
    n = N;
    for(int i = 0; i < N; i++){
        a[i] = A[i];
    }
    divide(1, 0, N - 1);
}

int getAns(int level, int l, int r, int L, int R){
    int mid = (l + r) / 2;
    if(L <= mid && mid <= R){
        return Secret(dp[level][L], dp[level][R]);
    }
}
int Query(int L, int R){
    if(L == R){
        return a[L];
    }
    return getAns(1, 0, n - 1, L, R);
    return 0;
}

Compilation message

secret.cpp: In function 'int getAns(int, int, int, int, int)':
secret.cpp:49:1: warning: control reaches end of non-void function [-Wreturn-type]
   49 | }
      | ^
# Verdict Execution time Memory Grader output
1 Incorrect 102 ms 2724 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 574960662.
2 Incorrect 104 ms 2644 KB Wrong Answer: Query(102, 157) - expected : 32612619, actual : 697381057.
3 Incorrect 101 ms 2648 KB Wrong Answer: Query(334, 369) - expected : 363022362, actual : 8613892.
4 Incorrect 372 ms 4536 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 274825282.
5 Incorrect 372 ms 4356 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 307380480.
6 Incorrect 372 ms 4420 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 547105756.
7 Correct 387 ms 4608 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
8 Correct 382 ms 4344 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
9 Correct 388 ms 4436 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
10 Correct 382 ms 4352 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1