fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int M;
  6. long long T;
  7. cin >> M >> T;
  8. long long mn = 1e10;
  9. int ans = -1;
  10. for (int i = 0; i < M; ++i) {
  11. long long t;
  12. int f;
  13. cin >> t >> f;
  14. if (T < t and t - T < mn) {
  15. mn = t - T;
  16. ans = f;
  17. }
  18. }
  19. cout << ans << endl;
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0.01s 5320KB
stdin
5 74
28 3
85 2
6 1
5 3
72 1
stdout
2