Submission #885476

# Submission time Handle Problem Language Result Execution time Memory
885476 2023-12-09T19:58:27 Z Karoot Secret (JOI14_secret) C++17
Compilation error
0 ms 0 KB
#include "secret.h"

const int MAXN = 1e3+1;
int SRQ[MAXN][MAXN];
int Arrl[MAXN];
int globul;

//int Secret(int X, int Y);


void initTree(int l, int r){
    int mid = (l+r)>>1;
    SRQ[mid][mid] = Arrl[mid];
    SRQ[mid+1][mid+1] = Arrl[mid+1];
    for (int i = mid-1; i >= l; i--){
        SRQ[mid][i] = Secret(Arrl[i], SRQ[mid][i+1]);
    }
    for (int i = mid+2; i <= r; i++){
        SRQ[mid+1][i] = Secret(Arrl[i], SRQ[mid+1][i-1]);
    }
    if (l < mid)initTree(l, mid);
    if (r > mid+1)initTree(mid+1, r);
}

int followInit(int wL, int wR){
    int a = 0, b = globul-1;
    while (a != b){
        int mid = (l+r)>>1;
        if (mid >= wL && mid < wR)return Secret(SRQ[mid][wL], SRQ[mid+1][wR]);
        if (mid == wR)return SRQ[mid][wL];

        if (mid >= wL){
            b = mid;
        } else {
            a = mid+1;
        }
    }
    return SRQ[0][0];
}

void Init(int N, int A[]){
    for (int i = 0; i < N; i++){
        Arrl[i] = A[i];
    }
    globul = N;
    initTree(0, N-1);
}

int Query(int L, int R){
    return followInit(L, R);
}

Compilation message

secret.cpp: In function 'int followInit(int, int)':
secret.cpp:28:20: error: 'l' was not declared in this scope
   28 |         int mid = (l+r)>>1;
      |                    ^
secret.cpp:28:22: error: 'r' was not declared in this scope
   28 |         int mid = (l+r)>>1;
      |                      ^