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;
using ll = long long ;
using pii = pair<ll , ll> ;
using i3 = tuple<ll , ll , ll> ;
const int N = 2e5+5 ;
const int MOD = 1e9+7 ;
int n ;
map<pii , bool> vis ;
struct Points {
int x , y ;
};
vector<Points> point ;
stack<Points> st ;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n ;
for(int i=0;i<n;i++){
int x , y ; cin >> x >> y ;
point.push_back({x , y}) ;
}
for(int i=0;i<n;i++){
while(!st.empty() && point[i].y - st.top().y >= point[i].x - st.top().x){
st.pop();
}
if(st.empty() || !(st.top().y - point[i].y >= point[i].x - st.top().x))
st.push(point[i]);
}
cout << st.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... |