이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |