Submission #734888

#TimeUsernameProblemLanguageResultExecution timeMemory
734888rahidilbayramliAdvertisement 2 (JOI23_ho_t2)C++17
100 / 100
457 ms9888 KiB
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define vl vector<ll>
#define sl set<ll>
#define pb push_back
#define all(v) v.begin(), v.end()
#define f first
#define s second
#define ld long double
using namespace std;
int main()
{
    ll n, x, e, i;
    cin >> n;
    vector<pair<ll, ll>>points(n);
    for(i = 0; i < n; i++)
    {
        cin >> x >> e;
        points[i] = {x-e, x+e};
    }
    sort(points.begin(), points.end(), [](auto &i, auto &j)
    {
        if(i.f != j.f)    return i.f < j.f;
        return i.s > j.s;
    });
    ll maxx = -1, k = 0;
    for(auto i : points)    if(maxx < i.s)    maxx = i.s, k++;
    cout << k << "\n";
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...