# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
141080 | tincamatei | Lightning Rod (NOI18_lightningrod) | C++14 | 639 ms | 188208 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>
const int BUFF = 1 << 12;
const int MAX_N = 10000000;
int cursor = BUFF - 1;
char buff[BUFF];
char getChar(FILE *fin) {
cursor++;
if(cursor == BUFF) {
cursor = 0;
fread(buff, 1, BUFF, fin);
}
return buff[cursor];
}
int getnr(FILE *fin) {
char ch = getChar(fin);
while(!isdigit(ch))
ch = fgetc(fin);
int nr = 0;
while(isdigit(ch)) {
nr = nr * 10 + ch - '0';
ch = getChar(fin);
}
return nr;
}
struct Point {
int x, y;
} v[MAX_N];
int main() {
int N, x, y;
Point pnt;
N = getnr(stdin);
int top = 0;
for(int i = 0; i < N; ++i) {
x = getnr(stdin);
y = getnr(stdin);
pnt = {x - y, x + y};
while(top > 0 && pnt.x <= v[top - 1].x && pnt.y >= v[top - 1].y)
--top;
if(top == 0 || (top > 0 && !(v[top - 1].x <= pnt.x && v[top - 1].y >= pnt.y)))
v[top++] = pnt;
}
printf("%d", top);
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... |