Advertisement
amine99

Untitled

Apr 30th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  4. #define ALL(x) x.begin(),x.end()
  5. #define SZ(x) x.size()
  6. #define PB push_back
  7. #define MP make_pair
  8. #define F first
  9. #define S second
  10. typedef long long LL;
  11. typedef vector<int> VI;
  12. typedef pair<int,int> PI;
  13.  
  14. bool compare(const pair<int,PI>&i ,const pair<int,PI>&j) {
  15.    return i.F < j.F;
  16. }
  17.  
  18. const int N=3e5+3;
  19. int n,l,r;
  20. pair<int,PI> a[N];
  21.  
  22. int main() {
  23.    io;
  24.    cin >> n;
  25.    for(int i = 0; i < n; i++) {
  26.       cin >> a[i].F >> a[i].S.F;
  27.       a[i].S.S = i+1;
  28.    }
  29.    sort(a,a+n,compare);
  30.    l = a[0].F;
  31.    r = a[0].S.F;
  32.    for(int i = 1; i < n; i++) {
  33.       if(a[i].S.F <= r) {
  34.          cout << a[i].S.S << " " << a[0].S.S;
  35.          return 0;
  36.       }
  37.    }
  38.    cout << "-1 -1";
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement