제출 #1032360

#제출 시각아이디문제언어결과실행 시간메모리
1032360Marco_EscandonA Difficult(y) Choice (BOI21_books)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; const string ny[2] = {"No", "Yes"}; //#include"books.h" void solve(int n, int k, long long A, int S) { ll cad[n+4]={ }; ll v[k+2]={ },ac=0; v[k+1]=n+1; for(int i=1; i<=k; i++) { cad[i]=skim(i); v[i]=i; ac+=cad[i]; } for(int i=k; i>0; i--) { while(v[i]<k&&v[i]+1<v[i+1]&&ac<A&&ac-cad[v[i]]+cad[v[i]+1]<=2*A) { ac-=cad[v[i]]; v[i]++; ac+=cad[v[i]]; } if(ac>=A) break; ll a=v[i]; ll b=v[i+1]; ac-=cad[v[i]]; while(abs(a-b)!=1) { ll m=(a+b)/2; if(cad[m]==0) cad[m]=skim(m); if(cad[m]+ac<=2*A) a=m; else b=m; } v[i]=b-1; ac+=cad[v[i]]; //while(v[i]+1<v[i+1]&&ac<a&&ac-cad[v[i]]+cad[v[i]+1]<=2*a) //{ // ac-=cad[v[i]]; // v[i]++; // ac+=cad[v[i]]; //} } if(ac<A||ac>2*A) { impossible(); return; } vector<int> ans; for(int i=1; i<=k; i++) ans.push_back(v[i]); answer(ans); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:13:10: error: 'skim' was not declared in this scope
   13 |   cad[i]=skim(i);
      |          ^~~~
books.cpp:31:25: error: 'skim' was not declared in this scope
   31 |    if(cad[m]==0) cad[m]=skim(m);
      |                         ^~~~
books.cpp:47:3: error: 'impossible' was not declared in this scope
   47 |   impossible();
      |   ^~~~~~~~~~
books.cpp:54:2: error: 'answer' was not declared in this scope
   54 |  answer(ans);
      |  ^~~~~~