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;
struct point
{
int x,y;
};
int n;
vector<point> vec;
int cnt = 0;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n;
stack<point> st;
for(int i=0;i<n;++i)
{
int a,b;
cin >> a >> b;
vec.push_back({a,b});
}
for(int i=0;i<n;++i)
{
while(!st.empty() && vec[i].y-st.top().y >= st.top().x-vec[i].x) st.pop();
if(st.empty() || !(vec[i].y-st.top().y >= st.top().x-vec[i].x))
{
// cout << "add " << vec[i].x << " " << vec[i].y << '\n';
st.push({vec[i].x,vec[i].y});
}
}
cout << st.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... |