You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
520 B
C++
22 lines
520 B
C++
#define _CRT_SECURE_NO_WARNINGS
|
|
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
const int N = 1e5 + 50;
|
|
int l[N], r[N];
|
|
int main()
|
|
{
|
|
int n;
|
|
scanf("%d", &n);
|
|
for (int i = 1; i <= n; i++)
|
|
scanf("%d%d", l + i, r + i);
|
|
int L = *min_element(l + 1, l + n + 1);
|
|
int R = *max_element(r + 1, r + n + 1);
|
|
int ans = -1;
|
|
for (int i = 1; i <= n; i++)
|
|
if (l[i] == L && r[i] == R)
|
|
ans = i;
|
|
printf("%d", ans);
|
|
return 0;
|
|
}
|