Submission #286153

#TimeUsernameProblemLanguageResultExecution timeMemory
286153YJUSecret (JOI14_secret)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #pragma GCC optimize("unroll-loops,no-stack-protector") using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll,ll> pll; const ll MOD=1e9+7; const ll MOD2=998244353; const ll N=2e3+5; const ld pi=3.14159265359; const ll INF=(1LL<<60); #define SQ(i) ((i)*(i)) #define REP(i,n) for(ll i=0;i<n;i++) #define REP1(i,n) for(ll i=1;i<=n;i++) #define pb push_back #define mp make_pair #define X first #define Y second #define setp setprecision #define lwb lower_bound #define SZ(_a) (ll)_a.size() ll pre[N][N],suf[N][N]; void Init(int n,int a[]){ function<void(ll,ll)> build [&](ll l,ll r){ if(l>=r)return ; ll mid=(l+r)/2; build(l,mid);build(mid+1,r); pre[mid][mid+1]=a[mid]; suf[mid][mid+1]=a[mid]; for(int i=mid+2;i<=r;i++)pre[mid][i]=Secret(pre[mid][i-1],a[i-1]); for(int i=mid;i>l;i--)suf[mid][i]=Secret(suf[mid][i+1],a[i-1]); } build(0,n); } ll q(ll l,ll r,ll ql,ll qr){ ll mid=(l+r)/2; if(ql<=mid&&mid<qr){ if(mid==ql)return pre[mid][qr]; if(mid==qr-1)return suf[mid][ql]; return Secret(pre[mid][qr],suf[mid][ql]); }else{ if(qr<=mid){ return q(l,mid,ql,qr); }else{ return q(mid+1,r,ql,qr); } } } int Query(int L,int R){ return q(0,n,L,R+1); }

Compilation message (stderr)

secret.cpp: In function 'void Init(int, int*)':
secret.cpp:26:32: error: expected primary-expression before ']' token
   26 |  function<void(ll,ll)> build [&](ll l,ll r){
      |                                ^
secret.cpp:27:3: error: expected primary-expression before 'if'
   27 |   if(l>=r)return ;
      |   ^~
secret.cpp:27:3: error: expected '}' before 'if'
secret.cpp:26:44: note: to match this '{'
   26 |  function<void(ll,ll)> build [&](ll l,ll r){
      |                                            ^
secret.cpp:28:11: error: 'l' was not declared in this scope
   28 |   ll mid=(l+r)/2;
      |           ^
secret.cpp:28:13: error: 'r' was not declared in this scope
   28 |   ll mid=(l+r)/2;
      |             ^
secret.cpp:29:3: error: 'build' was not declared in this scope
   29 |   build(l,mid);build(mid+1,r);
      |   ^~~~~
secret.cpp:32:40: error: 'Secret' was not declared in this scope
   32 |   for(int i=mid+2;i<=r;i++)pre[mid][i]=Secret(pre[mid][i-1],a[i-1]);
      |                                        ^~~~~~
secret.cpp:33:37: error: 'Secret' was not declared in this scope
   33 |   for(int i=mid;i>l;i--)suf[mid][i]=Secret(suf[mid][i+1],a[i-1]);
      |                                     ^~~~~~
secret.cpp: At global scope:
secret.cpp:35:7: error: expected constructor, destructor, or type conversion before '(' token
   35 |  build(0,n);
      |       ^
secret.cpp:36:1: error: expected declaration before '}' token
   36 | }
      | ^
secret.cpp: In function 'll q(ll, ll, ll, ll)':
secret.cpp:43:10: error: 'Secret' was not declared in this scope
   43 |   return Secret(pre[mid][qr],suf[mid][ql]);
      |          ^~~~~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:54:13: error: 'n' was not declared in this scope
   54 |  return q(0,n,L,R+1);
      |             ^