제출 #546446

#제출 시각아이디문제언어결과실행 시간메모리
546446d4xnA Difficult(y) Choice (BOI21_books)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; // // --- Sample implementation for the task books --- // // To compile this program with the sample grader, place: // books.h books_sample.cpp sample_grader.cpp // in a single folder and run: // g++ books_sample.cpp sample_grader.cpp // in this folder. // #define ll long long void solve(int N, int K, long long A, int S) { // TODO implement this function // impossible() // answer() // puedo hacer S preguntas // hay N libros // ordenados de mayor a menor por precio // tengo que comprar K // y la suma tiene que ser >= A y <= A*2 int l = K; int r = N; while (l < r) { int mid = (l+r)/2; ll x = skim(mid); ll low = x + (mid-1)*1; ll high = x*mid; if (low < A && high > A*2) impossible(); else if (low < A && high <= A*2) { l = mid+1; } else { r = mid-1; } } vector<int> ans; for (int i = l - K + 1; i <= l; i++) ans.pb(i); answer(ans); /* if (skim(2) == 42) { impossible(); } else { answer({1, 3}); } */ }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:46:46: error: 'class std::vector<int>' has no member named 'pb'
   46 |     for (int i = l - K + 1; i <= l; i++) ans.pb(i);
      |                                              ^~