Submission #941551

#TimeUsernameProblemLanguageResultExecution timeMemory
941551XiaoyangA Difficult(y) Choice (BOI21_books)C++17
Compilation error
0 ms0 KiB
#include "books.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define fi first #define se second #define pll pair<ll,ll> #define pb push_back #define debug(x) cerr<<#x<<"="<<x<<endl; #define MP make_pair #define rep(i,a,b) for(ll i=a;i<b;i++) #define SZ(x) (ll)x.size() #define ALL(x) x.begin(),x.end() #define endl "\n" const ll inf=1e18; const ll maxn=1e5+5; ll diff[maxn]; ll d(ll x){ if(diff[x])return diff[x]; return diff[x]=skim(x); } void solve(int n, int k, long long A, int s) { ll sum=0; vector<ll>ans; rep(i,1,n+1){ sum+=d(i); if(i<=k)ans.pb(i); } if(sum>2*A)impossible(); if(sum>=A)answer(ans); ll lo=1,hi=n; while(lo<hi){ ll mid=(cl+cr)>>1; if(d(mid)<=A)lo=mid; else hi=mid-1; } if(lo<=n and sum-skim(k)+skim(lo)<=2*A){ ans[k-1]=lo; answer(ans); } int idx=1; while(idx and sum<A){ ans[idx-1]=lo; sum-=skim(idx);idx++; sum+=skim(lo);lo--; } if(sum>=A)answer(ans); impossible(); }

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:34:19: error: could not convert 'ans' from 'vector<long long int>' to 'vector<int>'
   34 |  if(sum>=A)answer(ans);
      |                   ^~~
      |                   |
      |                   vector<long long int>
books.cpp:38:11: error: 'cl' was not declared in this scope; did you mean 'll'?
   38 |   ll mid=(cl+cr)>>1;
      |           ^~
      |           ll
books.cpp:38:14: error: 'cr' was not declared in this scope
   38 |   ll mid=(cl+cr)>>1;
      |              ^~
books.cpp:45:10: error: could not convert 'ans' from 'vector<long long int>' to 'vector<int>'
   45 |   answer(ans);
      |          ^~~
      |          |
      |          vector<long long int>
books.cpp:53:19: error: could not convert 'ans' from 'vector<long long int>' to 'vector<int>'
   53 |  if(sum>=A)answer(ans);
      |                   ^~~
      |                   |
      |                   vector<long long int>