I used the upper_bound function on a vector and this error occurred
no suitable conversion function from “__gnu_cxx::__normal_iterator<int *, std::vector<int, std::allocator>>” to “int” exists
Here is my code
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int k,m,n;
cin>>k>>m>>n;
vector<pair<int, int>> grass;
vector<int> nhojcow;
for(int i = 0; i < k; i++){
int p,t;
cin>>p>>t;
grass.push_back({p,t});
}
for(int i = 0;i<m;i++) cin>>nhojcow[i];
sort(begin(grass),end(grass));
sort(begin(nhojcow), end(nhojcow));
long long prefixsum[m+1];
for(int i = 1;i<=m;i++) prefixsum[i] += prefixsum[i-1] + nhojcow[i-1];
int index = 0;
for(int i = 0; i<k;i++){
int nextcow = upper_bound(begin(nhojcow), end(nhojcow), 1);
}
}
Thank everyone for helping me debug!