# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
515960 | Jomnoi | Lightning Rod (NOI18_lightningrod) | C++17 | 1891 ms | 79812 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>
#define DEBUG 0
using namespace std;
int main() {
int n;
scanf("%d", &n);
stack <pair <int, int>> stk;
for(int i = 1; i <= n; i++) {
int x, y;
scanf("%d %d", &x, &y);
while(!stk.empty() and stk.top().first >= x - y) {
stk.pop();
}
if(stk.empty() or x + y > stk.top().second) {
stk.emplace(x - y, x + y);
}
}
printf("%d", (int)stk.size());
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... |