이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pii pair<int,int>
#define fst first
#define snd second
using namespace std;
stack<pii> s;
int n,a,b;
inline int readInt() {
    int x = 0;
    char ch = getchar_unlocked();
    while (ch < '0' || ch > '9') ch = getchar_unlocked();
    while (ch >= '0' && ch <= '9'){
		x = (x << 3) + (x << 1) + ch - '0';
		ch = getchar_unlocked();
	}
    return x;
}
int main()
{
	n = readInt();
	for (int i=0;i<n;i++)
	{
		a = readInt();
		b = readInt();
		if (s.empty()) {s.push({a,b});}
		else 
		{
			if (a - s.top().fst > s.top().snd - b)
			{
				while (s.size())
				{
					if (a - s.top().fst <= b - s.top().snd) {s.pop();}
					else {break;}
				}
				s.push({a,b});
			}
		}
		//cout<<i<<" "<<s.size()<<"\n";
	}
	printf("%d\n",(int)s.size());
	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... |