제출 #1286709

#제출 시각아이디문제언어결과실행 시간메모리
1286709user736482A Difficult(y) Choice (BOI21_books)C++20
컴파일 에러
0 ms0 KiB
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pb push_back #define ff first #define ss second #define MOD 998244353LL #define INF 1000000001LL #define POT (1LL<<20) #define INFL 1000000000000000099LL #define pii pair<ll,ll> #define ppi pair<pii,ll> #define pip pair<ll,pii> #define ppp pair<pii,pii> #define vi vector<ll> #define vii vector<pii> #define al(x) x.begin(),x.end() #define rev(x) reverse(al(x)) #define X 18 template<typename T, typename U> pair<T, U> operator+(const pair<T, U>& a, const pair<T, U>& b) { return {a.first + b.first, a.second + b.second}; } template<typename T, typename U> pair<T, U> operator-(const pair<T, U>& a, const pair<T, U>& b) { return {a.first - b.first, a.second - b.second}; } template<typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os<<"{"<<p.ff<<", "<<p.ss<<"}"; return os; } template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "{"; for (size_t i = 0; i < v.size(); ++i) { if (i) os << ", "; os << v[i]; } os << "}"; return os; } void solve(int N,int K,ll a,int S){ ll n=N; ll k=K; ll s=S; vi v; ll b=0; for(ll i=1;i<k;i++){ v.pb(skim(i)); b+=v.back(); } ll pocz=k; ll kon=n+1; ll x,y=INFL; while(pocz!=kon){ ll md=(pocz+kon)/2; x=skim(md); if(b+x<a)pocz=md+1; else {kon=md;y=x;} } if(b+y<=2*a){ vector<int>ans; for(ll i=1;i<k;i++)ans.pb(i); ans.pb(pocz); answer(ans);return; } x=pocz-1; if(x<k){ impossible();return; } vector<int>ans; v.pb(0); for(ll i=1;i<=k;i++){ ans.pb(x); b+=skim(x); b-=v[v.size()-i]; x--; if(b>=a){ for(ll j=1;j<=k-i;j++)ans.pb(j); answer(ans); } } impossible(); }

컴파일 시 표준 에러 (stderr) 메시지

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:53:14: error: 'skim' was not declared in this scope
   53 |         v.pb(skim(i));
      |              ^~~~
books.cpp:61:11: error: 'skim' was not declared in this scope
   61 |         x=skim(md);
      |           ^~~~
books.cpp:69:9: error: 'answer' was not declared in this scope
   69 |         answer(ans);return;
      |         ^~~~~~
books.cpp:73:9: error: 'impossible' was not declared in this scope
   73 |         impossible();return;
      |         ^~~~~~~~~~
books.cpp:79:12: error: 'skim' was not declared in this scope
   79 |         b+=skim(x);
      |            ^~~~
books.cpp:84:13: error: 'answer' was not declared in this scope
   84 |             answer(ans);
      |             ^~~~~~
books.cpp:87:5: error: 'impossible' was not declared in this scope
   87 |     impossible();
      |     ^~~~~~~~~~