Submission #1144898

#TimeUsernameProblemLanguageResultExecution timeMemory
1144898minggaSecret (JOI14_secret)C++20
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" // #include "secret.h" using namespace std; #define ln "\n" #define pb push_back #define fi first #define se second #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) // #define int long long const int mod = 1e9 + 7; // const int inf = 2e18; const int N = 1005; int n, a[N], f[N][N], b[N]; // int Secret(int x, int y) { // assert(x != -1 and y != -1); // int ans = 0; // return x + y; // } void calc(int l, int r) { if(l >= r) return; int m = (l + r) >> 1; calc(l, m); calc(m + 1, r); f[m][m] = a[m]; for(int i = m - 1; i >= l; i--) f[i][m] = Secret(f[i + 1][m], a[i]); f[m + 1][m + 1] = a[m + 1]; for(int i = m + 2; i <= r; i++) f[m + 1][i] = Secret(f[m + 1][i - 1], a[i]); } void Init(int len, int arr[]) { n = len; for(int i = 1; i <= n; i++) a[i] = arr[i - 1]; for(int i = 1; i <= n; i++) { for(int j = i + 1; j <= n; j++) { f[i][j] = f[j][i] = -1; } } calc(1, n); } int Query(int l, int r) { l++, r++; if(l == r) return a[l]; for(int i = l; i <= r; i++) { if(f[l][i] == -1 and f[i][r] != -1) { return Secret(f[l][i - 1], f[i][r]); } } } //Testing // signed main() { // int n; cin >> n; // for(int i = 0; i < n; i++) { // cin >> b[i]; // } // Init(n, b); // int q; cin >> q; // for(int i = 1; i <= q; i++) { // int l, r; cin >> l >> r; // int ans = 0; // for(int i = l; i <= r; i++) ans += b[i]; // assert(Query(l, r) == ans); // cout << Query(l, r) << ln; // } // }

Compilation message (stderr)

secret.cpp: In function 'void calc(int, int)':
secret.cpp:29:51: error: 'Secret' was not declared in this scope
   29 |         for(int i = m - 1; i >= l; i--) f[i][m] = Secret(f[i + 1][m], a[i]);
      |                                                   ^~~~~~
secret.cpp:31:55: error: 'Secret' was not declared in this scope
   31 |         for(int i = m + 2; i <= r; i++) f[m + 1][i] = Secret(f[m + 1][i - 1], a[i]);
      |                                                       ^~~~~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:50:32: error: 'Secret' was not declared in this scope
   50 |                         return Secret(f[l][i - 1], f[i][r]);
      |                                ^~~~~~