Submission #574699

# Submission time Handle Problem Language Result Execution time Memory
574699 2022-06-09T09:32:09 Z SlavicG Secret (JOI14_secret) C++17
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"
using namespace std;
 
#define ll long long
 
#define       forn(i,n)              for(int i=0;i<n;i++)
#define          all(v)              v.begin(), v.end()
#define         rall(v)              v.rbegin(),v.rend()
 
#define            pb                push_back
#define          sz(a)               (int)a.size()

const int N = 1000;
int val[N][N], n, mm[N][N];
vector<int> a;
/*
int Secret(int l, int r) {
    return 69;
} 
*/

void build(int l, int r) {
    if(l >= r) return;
    int mid = l + r >> 1;

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

    for(int i = l; i <= mid; ++i) {
        for(int j = mid + 1; j <= r; ++j) {
            mm[i][j] = mid;
        }
    }

    build(l, mid);
    build(mid + 1, r);
}
void Init(int _n, vector<int> _a) {
    n = _n, a = _a;
    forn(i, N) forn(j, N) val[i][j] = -1;
    forn(i, n) val[i][i] = a[i];
    build(0, n - 1);
}

int Query(int l, int r) {
    if(val[l][r] != -1) return val[l][r];
    int mid = mm[l][r];
    return Secret(val[l][mid], val[mid + 1][r]);
}

/*
void solve() {  
    
}   
     
int32_t main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
}
*/

Compilation message

secret.cpp: In function 'void build(int, int)':
secret.cpp:24:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   24 |     int mid = l + r >> 1;
      |               ~~^~~
secret.cpp:27:21: error: 'Secret' was not declared in this scope
   27 |         val[l][i] = Secret(val[l][i - 1], val[i][i]);
      |                     ^~~~~~
secret.cpp:30:27: error: 'Secret' was not declared in this scope
   30 |         val[mid + 1][i] = Secret(val[mid + 1][i - 1], val[i][i]);
      |                           ^~~~~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:52:12: error: 'Secret' was not declared in this scope
   52 |     return Secret(val[l][mid], val[mid + 1][r]);
      |            ^~~~~~