khalid_hussain

276A Lunch Rush

Oct 13th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, k, f, t, i, ans;
  8.     bool flag = false;
  9.     cin >> n >> k;
  10.    
  11.     for (i=0; i<n; i++)
  12.     {
  13.         cin >> f >> t;
  14.        
  15.         if (t<=k)
  16.         {
  17.             if (f>ans)
  18.             {
  19.                 flag = true;
  20.                 ans = f;
  21.             }
  22.         }
  23.     }
  24.    
  25.     if (flag)
  26.         cout << ans;
  27.     else cout << -1;
  28.    
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment