This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
inline void read(int& x) {
x = 0;
char ch = getchar_unlocked();
while (ch&16){
x = (x << 3) + (x << 1) + (ch&15);
ch = getchar_unlocked();
}
}
struct T
{
int x;
int y;
};
bool eat(T a, T b)
{
return a.x <= b.x && a.y <= b.y;
}
signed main()
{
int n;
read(n);
vector<T> stk;
stk.reserve(n);
for (int i = 1; i <= n; i++)
{
int x, y;
read(x);
read(y);
T cur = {-x - y, x - y};
if (stk.empty())
{
stk.push_back(cur);
}
else
{
if (eat(stk.back(), cur))
{
continue;
}
while (!stk.empty() && eat(cur, stk.back()))
{
stk.pop_back();
}
stk.push_back(cur);
}
}
cout << (int) stk.size() << "\n";
return 0;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |