Submission #1221328

#TimeUsernameProblemLanguageResultExecution timeMemory
1221328sula2Advertisement 2 (JOI23_ho_t2)C++20
100 / 100
261 ms4768 KiB
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
using namespace std;

int main() {
    int n; cin >> n;
    pair<int,int> a[n];
    // x[j] - x[i] <= e[i] - e[j]
    // x[j] + e[j] <= e[i] + x[i]
    //
    // x[i] - x[j] <= e[i] - e[j]
    // e[j] - x[j] <= e[i] - x[i]
    //
    // X[i] >= X[j]
    // Y[i] >= Y[j]
    for (auto& [x, y] : a) {
        int pos, inf; cin >> pos >> inf;
        x = inf + pos;
        y = inf - pos;
    }
    sort(a, a+n, greater<>());
    int mx = INT_MIN, ans = 0;
    for (auto [x, y] : a) {
        if (y > mx) {
            ans++;
            mx = y;
        }
    }
    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...