| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 866433 | yeediot | Advertisement 2 (JOI23_ho_t2) | C++14 | 139 ms | 18108 KiB | 
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;
#define int long long
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pb push_back
#define sz(x) (int)(x.size())
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define vi vector<int>
#define vp vector<pii>
#define vvi vector<vi>
//Don't open the standings during contests.
void setIO(string s) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
}
bool cmp(pii a,pii b){
    if(b.S!=a.S)return a.S>b.S;
    return a.F>b.F;
}
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    vector<pii>v;
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        v.pb({b-a,b+a});
    }
    sort(all(v),cmp);
    int mx=-8e18;
    int ans=0;
    for(int i=0;i<n;i++){
        //cout<<v[i].F<<' '<<v[i].S<<'\n';
        if(v[i].F>mx){
            mx=v[i].F;
            ans++;
        }
    }
    cout<<ans<<'\n';
}
 /*
 input:
  if(x_i>x_j) e_j-x_j<=e_i-x_i
 */
Compilation message (stderr)
| # | 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... | ||||
