제출 #1189737

#제출 시각아이디문제언어결과실행 시간메모리
1189737PlayVoltzA Difficult(y) Choice (BOI21_books)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "books.h"
using namespace std;

void solve(int n, int k, long long a, int s){
	int sum=0, low=k-1, high=n+1;
	vector<int> vect(n+1), ans, temp;
	for (int i=1; i<=k; ++i)vect[i]=skim(i), sum+=vect[i];
	if (sum>2*a){
		impossible();
		return;
	}
	sum-=vect[k];
	while (low+1<high){
		int mid=(low+high)/2;
		vect[mid]=skim(mid);
		if (sum+vect[mid]>=a)high=mid;
		else low=mid;
	}
	if (sum+vect[high]<=2*a){
		for (int i=1; i<k; ++i)ans.pb(i);
		ans.pb(high);
		answer(ans);
		return;
	}
	for (int i=1; i<=k; ++i)temp.pb(i);
	for (int i=max(k, high-k); i<high; ++i)vect[i]=skim(i), temp.pb(i);
	for (int i=k, sum=0; i<=temp.size(); ++i){
		for (int j=i-k; j<i; ++j)sum+=vect[temp[j]];
		if (a<=sum&&sum<=2*a){
			for (int j=i-k; j<i; ++j)ans.pb(temp[j]);
			answer(ans);
			return;
		}
	}
	impossible();
}

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:21:44: error: 'class std::vector<int>' has no member named 'pb'
   21 |                 for (int i=1; i<k; ++i)ans.pb(i);
      |                                            ^~
books.cpp:22:21: error: 'class std::vector<int>' has no member named 'pb'
   22 |                 ans.pb(high);
      |                     ^~
books.cpp:26:38: error: 'class std::vector<int>' has no member named 'pb'
   26 |         for (int i=1; i<=k; ++i)temp.pb(i);
      |                                      ^~
books.cpp:27:70: error: 'class std::vector<int>' has no member named 'pb'
   27 |         for (int i=max(k, high-k); i<high; ++i)vect[i]=skim(i), temp.pb(i);
      |                                                                      ^~
books.cpp:31:54: error: 'class std::vector<int>' has no member named 'pb'
   31 |                         for (int j=i-k; j<i; ++j)ans.pb(temp[j]);
      |                                                      ^~