Submission #701821

#TimeUsernameProblemLanguageResultExecution timeMemory
701821RandomLBSecret (JOI14_secret)C++17
Compilation error
0 ms0 KiB
#include <algorithm> #include <bits/stdc++.h> #include <queue> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pi; typedef vector<int> vi; #define pb push_back #define siz(x) (int)x.size() #define all(x) x.begin(), x.end() #define ms(x, a) memset(x, a, sizeof(x)) #define deb(...) logger(#__VA_ARGS__, __VA_ARGS__) template<typename ...Args> void logger(string vars, Args&&... values){ cout << vars << " = "; string delim = ""; (...,(cout << delim << values, delim = ", ")); cout << endl; } const int INF = 0x3f3f3f3f; //================================= const int MAX = 1005; int arr[MAX], res[MAX][MAX], n; int secret(int a, int b){ return a+b/2*2; } void solve(int l, int r){ if (l == r) return; int m = l+(r-l)/2; res[m][m] = arr[m], res[m+1][m+1] = arr[m+1]; for (int i = m-1; i >= l; i--) res[i][m] = Secret(arr[i], res[i+1][m]); for (int i = m+2; i <= r; i++) res[m+1][i] = Secret(res[m+1][i-1], arr[i]); solve(l, m); solve(m+1, r); } int solve(int l, int r, int tl, int tr){ int m = l+(r-l)/2; if (tl <= m && m < tr) return Secret(res[tl][m], res[m+1][tr]); return (tr <= m? solve(l, m, tl, tr) : solve(m+1, r, tl, tr)); } void Init(int N, vi v){ n = N; for (int i = 0; i < n; i++) arr[i] = v[i]; solve(0, n-1); } int query(int l, int r){ if (l == r) return arr[l]; return solve(0, n-1, l, r); }

Compilation message (stderr)

secret.cpp: In function 'void solve(int, int)':
secret.cpp:32:45: error: 'Secret' was not declared in this scope; did you mean 'secret'?
   32 |  for (int i = m-1; i >= l; i--) res[i][m] = Secret(arr[i], res[i+1][m]);
      |                                             ^~~~~~
      |                                             secret
secret.cpp:33:47: error: 'Secret' was not declared in this scope; did you mean 'secret'?
   33 |  for (int i = m+2; i <= r; i++) res[m+1][i] = Secret(res[m+1][i-1], arr[i]);
      |                                               ^~~~~~
      |                                               secret
secret.cpp: In function 'int solve(int, int, int, int)':
secret.cpp:39:32: error: 'Secret' was not declared in this scope; did you mean 'secret'?
   39 |  if (tl <= m && m < tr) return Secret(res[tl][m], res[m+1][tr]);
      |                                ^~~~~~
      |                                secret