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