#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
typedef long long ll;
typedef long double ld;
#define endl "\n"
#define vll vector<ll>
#define sd second
#define ft first
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define pll pair<ll, ll>
#define mod 998244353
#define _set tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update>
#define inf (ll)1e15
#define PRESICION(x) cout.setf(ios::fixed,ios::floatfield); cout.precision(x);
#define dgb(x) cout<<#x<<" : "<<x<<"\n"
using namespace std;
using namespace __gnu_pbds;
ll dx[]={1, -1, 0, 0};
ll dy[]={0, 0, 1, -1};
inline ll sm(ll a, ll b){
return ((a%mod)+(b%mod))%mod;
}
inline ll ml(ll a, ll b){
return ((a%mod)*(b%mod))%mod;
}
inline ll rs(ll a, ll b){
return ((a%mod)-(b%mod)+mod)%mod;
}
ll bpow(ll a , ll b) {
if (b==0)return 1;
if (b%2!=0)return ((bpow(a, b-1)%mod)*(a%mod))%mod;
ll r=bpow (a ,b/ 2) ;
return ((r%mod)*(r%mod))%mod;
}
inline ll q(vector<ll>& v1, ll l, ll r){
return (l==0 ? v1[r]: v1[r]-v1[l-1]);
}
inline void solve(){
ll a, b, c=0 , d=0, e, f=0, g=0, h=1;
cin>>a;
vector<pair<ll, ll>> v(a);
for(int i=0; i<a; i++)cin>>v[i].sd>>v[i].ft;
sort(allr(v));
c=1;
d=0;
for(int i=1; i<a; i++){
if(abs(v[i].sd-v[d].sd)>v[d].ft-v[i].ft){d=i;c++;}
}
cout<<c<<endl;
}
int main(){
//freopen("time.in", "r", stdin);freopen("time.out", "w", stdout);
ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
//PRESICION(15)
//int t;cin>>t;while(t--)
solve();
}
# | 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... |