fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. vector<int>v = {5,9,10,10,10,10,11,11,11};
  6. auto it= upper_bound(v.begin(),v.end(),11);
  7. int idx = it-v.begin();
  8. cout<<" idx is "<<idx<<endl;
  9. }
Success #stdin #stdout 0.01s 5328KB
stdin
Standard input is empty
stdout
 idx is 9