fork(3) download
  1. #include<iostream>
  2. #include<vector>
  3. #include<algorithm>
  4. #define pp pair<int,int>
  5. using namespace std;
  6. bool cmp(const pp &l,const pp &r)
  7. {
  8. return l.first<r.first;
  9. }
  10. int main()
  11. {
  12. vector<pp> v;
  13. v.push_back(pp(5,1));
  14. v.push_back(pp(4,2));
  15. v.push_back(pp(5,3));
  16. v.push_back(pp(2,4));
  17. sort(v.begin(),v.end(),cmp);
  18. int id=(int)(lower_bound(v.begin(),v.end(),pp(5,0),cmp)-v.begin());
  19. cout<<id<<endl;
  20. }
Success #stdin #stdout 0s 2864KB
stdin
Standard input is empty
stdout
2