Submission #482719

#TimeUsernameProblemLanguageResultExecution timeMemory
482719FystyA Difficult(y) Choice (BOI21_books)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include "books.h" #include <random> #include <chrono> using namespace std; //#pragma GCC optimize("Ofast") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<double,double> pdd; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); template<typename T> void _do(T x){cerr<<x<<"\n";} template<typename T,typename ...U> void _do(T x,U ...y){cerr<<x<<", ";_do(y...);} #define dbg(...) cerr<<#__VA_ARGS__<<" = ";_do(__VA_ARGS__); const int MOD1=1e9+7; const int MOD2=998244353; const ll INF=3e18; const ld PI=3.14159265358979323846; ll gcd(ll a,ll b){if(b==0) return a; return gcd(b,a%b);} ll fpow(ll a,ll b,ll m) { if(!b) return 1; ll ans=fpow(a*a%m,b/2,m); return (b%2?ans*a%m:ans); } ll inv(ll a,ll m) {return fpow(a,m-2,m);} #define MottoHayaku ios::sync_with_stdio(false);cin.tie(0); #define int ll #define rep(i,n) for(ll i=0;i<n;i++) #define rep1(i,n) for(ll i=1;i<=n;i++) #define repk(i,m,n) for(int i=m;i<n;i++) #define F first #define S second #define pb push_back #define lb lower_bound #define ub upper_bound #define uni(c) c.resize(distance(c.begin(),unique(c.begin(),c.end()))) #define unisort(c) sort(c.begin(),c.end()),uni(c) ll a[100005]; //ll skim(ll n){} //void answer(vector<ll> ans){} //void impossible(){} void solve(int n,int k,ll A,int S) { if(n==k) { ll tot=0; vector<ll> ans; rep1(i,n) { a[i]=skim(i); ans.pb(i); tot+=a[i]; } if(tot>=A&&tot<=2*A) answer(ans); else impossible(); return; } ll tot=0; rep1(i,k) { a[i]=skim(i); tot+=a[i]; } if(a[k]>=A) { if(tot>=A&&tot<=2*A) { vector<ll> ans; rep1(i,k) ans.pb(i); answer(ans); } else impossible(); return; } ll l=k+1,r=n+1; while(l<r) { ll mid=l+r>>1; a[mid]=skim(mid); if(a[mid]<A) l=mid+1; else r=mid; } if(l!=n+1) { if(a[l]==0) a[l]=skim(l); vector<ll> ans={l}; tot=a[l]; rep1(i,k-1) { tot+=a[i]; ans.pb(i); } if(tot>=A&&tot<=2*A) { answer(ans); return; } } l--; ll cnt=0; for(int i=l;i>=1;i--) { if(cnt==k) break; if(a[i]==0) { cnt++; a[i]=skim(i); } } if(l==k) { ll tot=0; vector<ll> ans; rep1(i,k) { ans.pb(i); tot+=a[i]; } if(tot>=A&&tot<=2*A) answer(ans); else impossible(); return; } rep(i,k+1) { vector<ll> ans; ll tot=0; rep1(j,k-i) { tot+=a[j]; ans.pb(j); } rep(j,i) { tot+a[l-j]; ans.pb(l-j); } if(tot>=A&&tot<=2*A) { answer(ans); return; } } impossible(); }

Compilation message (stderr)

books.cpp: In function 'void solve(ll, ll, ll, ll)':
books.cpp:58:18: error: 'skim' was not declared in this scope
   58 |             a[i]=skim(i);
      |                  ^~~~
books.cpp:62:30: error: 'answer' was not declared in this scope
   62 |         if(tot>=A&&tot<=2*A) answer(ans);
      |                              ^~~~~~
books.cpp:63:14: error: 'impossible' was not declared in this scope
   63 |         else impossible();
      |              ^~~~~~~~~~
books.cpp:69:14: error: 'skim' was not declared in this scope
   69 |         a[i]=skim(i);
      |              ^~~~
books.cpp:78:13: error: 'answer' was not declared in this scope
   78 |             answer(ans);
      |             ^~~~~~
books.cpp:80:14: error: 'impossible' was not declared in this scope
   80 |         else impossible();
      |              ^~~~~~~~~~
books.cpp:86:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   86 |         ll mid=l+r>>1;
      |                ~^~
books.cpp:87:16: error: 'skim' was not declared in this scope
   87 |         a[mid]=skim(mid);
      |                ^~~~
books.cpp:93:26: error: 'skim' was not declared in this scope
   93 |         if(a[l]==0) a[l]=skim(l);
      |                          ^~~~
books.cpp:103:13: error: 'answer' was not declared in this scope
  103 |             answer(ans);
      |             ^~~~~~
books.cpp:115:18: error: 'skim' was not declared in this scope
  115 |             a[i]=skim(i);
      |                  ^~~~
books.cpp:127:30: error: 'answer' was not declared in this scope
  127 |         if(tot>=A&&tot<=2*A) answer(ans);
      |                              ^~~~~~
books.cpp:128:14: error: 'impossible' was not declared in this scope
  128 |         else impossible();
      |              ^~~~~~~~~~
books.cpp:142:16: warning: statement has no effect [-Wunused-value]
  142 |             tot+a[l-j];
      |             ~~~^~~~~~~
books.cpp:147:13: error: 'answer' was not declared in this scope
  147 |             answer(ans);
      |             ^~~~~~
books.cpp:151:5: error: 'impossible' was not declared in this scope
  151 |     impossible();
      |     ^~~~~~~~~~