This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <ctype.h>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin (),v.end()
using namespace std;
int n;
vector<pair<int, int>> p;
bool can;
int Main()
{
sort(all(p), [](pair<int, int> a, pair<int, int> b) {
if (a.second != b.second)
return a.second < b.second;
return a.first < b.first;
});
can = 1;
for (int i = 1; i < n; i++)
if (p[i].first < p[i - 1].second)
can = 0;
return 0;
}
LL plan_roller_coaster(vector<int> S, vector<int> T)
{
n = S.size();
while (!S.empty())
{
p.PB(MP(S.back(), T.back()));
S.pop_back();
T.pop_back();
}
Main();
return can;
}
#ifdef death
int main()
{
int N;
vector<int> S,T;
cin >> N;
for (int i = 0; i < N; i++)
{
S.PB(0);
cin >> S.back();
T.PB(0);
cin >> T.back();
}
cout << plan_roller_coaster(S,T) << endl;
return 0;
}
#endif
/*
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |