Submission #831091

#TimeUsernameProblemLanguageResultExecution timeMemory
831091starchanSecret (JOI14_secret)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "secret.h" using namespace std; #define in pair<int, int> #define f first #define s second #define pb push_back #define pob pop_back #define INF (int)1e17 #define MX (int)1e3+5 #define fast() ios_base::sync_with_stdio(false); cin.tie(NULL) int table[MX][MX]; void build(const int a[], int l, int r) { int m = (l+r)/2; if(l == r) { tree[m][m] = a[m]; return; } table[m][m] = a[m]; for(int i = m-1; i >= l; i--) table[i][m] = Secret(a[i], table[i+1][m]); table[m+1][m+1] = a[m+1]; for(int i = m+2; i <= r; i++) table[m+1][i] = Secret(table[m+1][i-1], a[i]); build(a, l, m); build(a, m+1, r); return; } int query(int ql, int qr, int l, int r) { if(ql == qr) return table[ql][qr]; int m = (l+r)/2; if(ql == (m+1)) return table[m+1][qr]; else if(qr == m) return table[ql][m]; if(qr < m) return query(ql, qr, l, m); else if(ql >= (m+2)) return query(ql, qr, m+1, r); else return Secret(table[ql][m], table[m+1][qr]); } void Init(int n, int a[]) { build(a, 0, n-1); XXX = n; return; } int Query(int l, int r) { return query(l, r, 0, XXX-1); }

Compilation message (stderr)

secret.cpp: In function 'void build(const int*, int, int)':
secret.cpp:18:3: error: 'tree' was not declared in this scope; did you mean 'free'?
   18 |   tree[m][m] = a[m];
      |   ^~~~
      |   free
secret.cpp: In function 'void Init(int, int*)':
secret.cpp:50:2: error: 'XXX' was not declared in this scope
   50 |  XXX = n;
      |  ^~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:55:24: error: 'XXX' was not declared in this scope
   55 |  return query(l, r, 0, XXX-1);
      |                        ^~~