Submission #1094757

# Submission time Handle Problem Language Result Execution time Memory
1094757 2024-09-30T13:10:45 Z asli_bg Secret (JOI14_secret) C++11
Compilation error
0 ms 0 KB
#pragma GCC optimize("O3,unroll-loops")

#include <bits/stdc++.h>
using namespace std;

//#define int long long

#include "secret.h"

#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
 
#define FOR(i,a) for(int i=0;i<(a);i++)
#define FORE(i,a,b) for(int i=(a);i<(b);i++)
#define cont(x) {for(auto el:x) cout<<el<<' ';cout<<endl;}
#define contp(x) {for(auto el:x) cout<<el.fi<<'-'<<el.se<<' ';cout<<endl;}
#define sp <<" "<<
//#define mid (l+r)/2
#define endl '\n'
 
#define DEBUG(X) {cout<<#X<<' '<<(X)<<endl;}
 
#define carp(x,y) ((x%MOD)*(y%MOD))%MOD
#define topla(x,y) ((x%MOD)+(y%MOD))%MOD
 
typedef vector<int> vi;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<bool> vb;

const int MAXN=1e3+5;
const int MAXK=20;

vi a;
int n;
int tut[MAXK][MAXN];
int mask[MAXN];

void dq(int l,int r){
    if(l>=r) return;

    int mid=(l+r)/2;

    tut[mid][mid]=a[mid];
    tut[mid+1][mid+1]=a[mid+1];

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

    dq(l,mid);
    dq(mid+1,r);
}


void Init(int N, int A[]) {
    n=N;
    a.resize(N+1);
    FOR(i,N) a[i+1]=A[i];
    dq(1,N);
}

int Query(int l, int r) {
    int bas=1;
    int son=n;
    while(bas!=son){
        int mid=(bas+son)/2;
        if(l<=mid and mid<r) return Secret(tut[mid][l],tut[mid+1][r]);
        else if(mid==r) return tut[mid][l];
        else if(mid<l) bas=mid+1;
        else son=mid;
    }

    return tut[l][l];
}

Compilation message

secret.cpp: In function 'void dq(int, int)':
secret.cpp:52:32: error: 'lev' was not declared in this scope
   52 |         tut[mid][i]=Secret(tut[lev][i+1],a[i]);
      |                                ^~~
secret.cpp:55:34: error: 'lev' was not declared in this scope
   55 |         tut[mid+1][i]=Secret(tut[lev][i-1],a[i]);
      |                                  ^~~