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")
#define ll long long
#define pii pair<long long,long long>
#define F first
#define S second
#define pb emplace_back
#define endl "\n"
#define all(a) a.begin(),a.end()
#define int long long
void solve(){
int n;
cin>>n;
vector<pii> a(n);
for(int i=0;i<n;i++){
cin>>a[i].F>>a[i].S;
}
sort(all(a));
vector<pii> stk;
for(int i=0;i<n;i++){
if(stk.size()&&stk.back().F+stk.back().S-a[i].S>=a[i].F) continue;
while(stk.size()&&a[i].F-a[i].S+stk.back().S<=stk.back().F) stk.pop_back();
stk.pb(a[i]);
}
cout<<(int)stk.size();
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int t=1;
//cin>>t;
while(t--){
solve();
}
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... |