Submission #636537

# Submission time Handle Problem Language Result Execution time Memory
636537 2022-08-29T13:35:02 Z JooDdae Secret (JOI14_secret) C++17
Compilation error
0 ms 0 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
 
#define mid ((l+r) >> 1)
 
int n, a[1010];
vector<int> LL[4040], RR[4040];
 
void build(int node = 1, int l = 1, int r = n) {
    if(l > r) return;
 
    LL[node].push_back(a[mid]);
    for(int i=mid-1;i>=l;i--) {
        LL[node].push_back(Secret(a[i], LL[node].back()));
    }
 
    if(l == r) return;
 
    RR[node].push_back(a[mid+1]);
    for(int i=mid+2;i<=r;i++) {
        RR[node].push_back(Secret(RR[node].back(), a[i]));
    }
 
    build(node*2, l, mid-1), build(node*2+1, mid+1, r);
}
 
void Init(int N, int A[]) {
    n = N;
    for(int i=1;i<=n;i++) a[i] = A[i-1];
    build();
}
 
 
int find(int nl, int nr, int node = 1, int l = 1, int r = n) {
    if(nl <= mid && mid <= nr) {
        if(mid == nr) return LL[node][mid-nl];
        return Secret(LL[node][mid-nl], RR[node][nr-mid-1]);
    }
 
    if(nr < mid) return find(nl, nr, node*2, l, mid-1);
    return find(nl, nr, node*2+1, mid+1, r);
}
 
int Query(int L, int R) {
    return find(L+1, R+1);

Compilation message

secret.cpp: In function 'int Query(int, int)':
secret.cpp:46:26: error: expected '}' at end of input
   46 |     return find(L+1, R+1);
      |                          ^
secret.cpp:45:25: note: to match this '{'
   45 | int Query(int L, int R) {
      |                         ^