# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
373826 | guka415 | Lightning Rod (NOI18_lightningrod) | C++14 | 2094 ms | 152868 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.
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <unordered_map>
#include <map>
using namespace std;
typedef pair<int, int> pii;
int n;
map<int, int, greater<int>> mem;
int main() {
int x, y, ret = 0, sum, diff;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d %d", &x, &y);
sum = y - x, diff = y + x;
if (mem.find(sum) == mem.end() || mem[sum] < diff)
mem[sum] = diff;
}
int prv = -2e9;
for (auto ii : mem) {
if (prv < ii.second)
ret++, prv = ii.second;
}
printf("%d", ret);
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |