# |
Author |
Problem |
Lang |
Verdict |
Time |
Memory |
Sent |
Judged |
|
89098170 |
Practice:
Unic_0rn |
479C
- 43
|
C++14 (GCC 6-32)
|
Runtime error on test 26
|
218 ms
|
3940 KB
|
2020-08-06 10:43:23 |
2020-08-06 10:43:23 |
|
/*
code_template
author: @unic0rn
*/
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#define IL(a, b, c) for (a = b; a < c; a++)
#define DL(a, b, c) for (a = b; a >= c; a--)
#define ll long long
#define ld double
#define N 1000000007
#define MAX 10001
using namespace std;
bool compare(pair<ll, ll> a, pair<ll, ll> b) {
if (a.first > b.first) {
return false;
}
if (a.first==b.first) {
if (a.second > b.second) {
return false;
}
}
return true;
}
int main()
{
int testCases=1, i, j, n;
ll a, b;
bool flag = false;
vector<pair<ll, ll>> dates;
while (testCases--)
{
cin >> n;
IL(i, 0, n) {
cin >> a >> b;
dates.push_back({ a, b });
}
sort(dates.begin(), dates.end(), compare);
// IL(i, 0, n) {
// cout << dates[i].first << ' ' << dates[i].second << endl;
// }
ll curr = -1;
IL(i, 0, n) {
if (dates[i].second>=curr) {
curr = dates[i].second;
}
else {
curr = dates[i].first;
}
}
cout << curr << endl;
}
return 0;
}
Click to see test details