# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
905220 | Petrix | Advertisement 2 (JOI23_ho_t2) | C++17 | 129 ms | 13924 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 <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
int ri() {
int n;
scanf("%d", &n);
return n;
}
int main() {
int N = ri();
std::vector<std::pair<int, int> > points(N);
for (int i = 0; i < N; i++) {
int X = ri();
int E = ri();
points[i] = {X - E, X + E}; // {a[i], b[i]}
}
// aåŒã˜ãªã‚‰bé™é †ã«ã™ã‚‹ã¨ã€aãŒåŒã˜ã‚„ã¤ã§è¤‡æ•°å›žbã®æœ€å¤§å€¤ã‚’æ›´æ–°ã—ã¦ã—ã¾ã£ãŸã‚Šã—ãªããªã‚‹
std::sort(points.begin(), points.end(), [] (auto &i, auto &j) {
if (i.first != j.first) return i.first < j.first;
return i.second > j.second;
});
int max = -1;
int cnt = 0;
for (auto i : points) if (max < i.second) max = i.second, cnt++;
printf("%d\n", cnt);
return 0;
}
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... |