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;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,sse4")
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
const int mxn = 1e7+10;
pii arr[mxn];
int N;
vector<int> st;
inline bool cover(pii &a,pii &b){
if(a.fs < b.fs){
return a.sc-a.fs<=b.sc-b.fs;
}
else return a.sc+a.fs<=b.sc+b.fs;
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>N;
for(int i = 0;i<N;i++){
cin>>arr[i].fs>>arr[i].sc;
}
for(int i = 0;i<N;i++){
while(!st.empty()&&cover(arr[st.back()],arr[i]))st.pop_back();
if(st.empty()||!cover(arr[i],arr[st.back()]))st.push_back(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... |