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;
int n,x,y;
stack<pair<int, int>> s;
inline void read(int &x)
{
x = 0;
char ch = getchar_unlocked();
while (ch & 16)
{
x = (x << 3) + (x << 1) + (ch & 15);
ch = getchar_unlocked();
}
}
int main()
{
ios_base::sync_with_stdio(0),cin.tie(0);
read(n);
for(int i = 0; i<n; ++i){
read(x); read(y);
if(!s.empty() && abs(s.top().first-x)<=s.top().second-y){
continue;
}
while(!s.empty() && abs(x-s.top().first)<=y-s.top().second) s.pop();
s.push({x,y});
}
cout<<s.size();
}
# | 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... |