제출 #1221315

#제출 시각아이디문제언어결과실행 시간메모리
1221315sula2Advertisement 2 (JOI23_ho_t2)C++20
10 / 100
266 ms6480 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]
    for (auto& [x, y] : a) {
        int pos, inf; cin >> pos >> inf;
        x = inf + pos;
        y = inf - pos;
    }
    sort(a, a+n, greater<>());
    vector<int> lis;
    for (auto [x, y] : a) {
        auto it = lower_bound(all(lis), y);
        if (it == lis.end())
            lis.push_back(y);
        else
            *it = y;
    }
    cout << lis.size();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...