fork(3) download
  1. #include <iostream>
  2. #include <set>
  3. using namespace std;
  4.  
  5. struct node {
  6. int i, j, val;
  7. };
  8.  
  9. struct my_comparator {
  10. bool operator()(const node& a, const node& b) {
  11. return a.val < b.val;
  12. }
  13. };
  14.  
  15. int main() {
  16. set<node, my_comparator> S;
  17. S.insert({1,23,4});
  18. S.insert({3,41,1});
  19. S.insert({2,12,2});
  20.  
  21. cout << (*S.lower_bound({0, 0, 2})).val << endl;
  22.  
  23. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
2