Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
- #define ALL(x) x.begin(),x.end()
- #define SZ(x) x.size()
- #define PB push_back
- #define MP make_pair
- #define F first
- #define S second
- typedef long long LL;
- typedef vector<int> VI;
- typedef pair<int,int> PI;
- bool compare(const pair<int,PI>&i ,const pair<int,PI>&j) {
- return i.F < j.F;
- }
- const int N=3e5+3;
- int n,l,r;
- pair<int,PI> a[N];
- int main() {
- io;
- cin >> n;
- for(int i = 0; i < n; i++) {
- cin >> a[i].F >> a[i].S.F;
- a[i].S.S = i+1;
- }
- sort(a,a+n,compare);
- l = a[0].F;
- r = a[0].S.F;
- for(int i = 1; i < n; i++) {
- if(a[i].S.F <= r) {
- cout << a[i].S.S << " " << a[0].S.S;
- return 0;
- }
- }
- cout << "-1 -1";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement