# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
200040 | wilwxk | Lightning Rod (NOI18_lightningrod) | C++14 | 2037 ms | 131000 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 <bits/stdc++.h>
using namespace std;
const int MAXN = 1e7+7;
pair<int, int> v[MAXN];
int n;
int main() {
scanf("%d", &n);
for(int i = 1; i <= n; i++) {
int a, b; scanf("%d %d", &a, &b);
v[i].first = a+b;
v[i].second = b-a;
}
sort(v+1, v+1+n);
int ans = 0; int mx = -(2e9+7);
for(int i = n; i >= 1; i--) if(v[i].second > mx) mx = v[i].second, ans++;
printf("%d\n", ans);
}
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... |