# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1182809 | william889 | Advertisement 2 (JOI23_ho_t2) | C++20 | 0 ms | 0 KiB |
# include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a[n],b[n];
pair<int,int>v[n];
for(int i=0;i<n;i++){
cin>>a[i]>>b[i];
v[i].first=a[i]-b[i];
v[i].second=-a[i]-b[i];
}
long long ans=0,cur=-1e9;
for(int i=0;i<n;i++){
a[i].second=-a[i].second;
if(a[i].second>cur){
ans++;
cur=a[i].second;
}
}
cout<<ans;
}