#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
using namespace std;
const int sz = 1e7 + 5;
int n;
int p[sz][2];
int mxx[sz];
inline int readInt() {
int x = 0; char ch = getchar(); bool s = 1;
while (ch<'0' || ch>'9') { if (ch == '-')s = 0; ch = getchar(); }
while (ch >= '0'&&ch <= '9') { x = (x << 3) + (x << 1) + ch - '0'; ch = getchar(); }
return s ? x : -x;
}
int main() {
int xp, yp, ret = 0, prvmny;
n = readInt();
for (int i = 0; i < n; i++) {
xp = readInt();
yp = readInt();
p[i][0] = xp + yp;
p[i][1] = xp - yp;
}
mxx[0] = p[0][0];
for (int i = 1; i < n; i++)
mxx[i] = (mxx[i - 1] < p[i][0] ? p[i][0] : mxx[i - 1]);
prvmny = p[n - 1][1];
for (int i = n - 2; i >= 1; i--) {
ret += (mxx[i - 1]<p[i][0] && prvmny>p[i][1]);
prvmny = (prvmny > p[i][1] ? p[i][1] : prvmny);
}
ret += (prvmny > p[0][1]);
ret += (mxx[n - 2] < p[n - 1][0]);
printf("%d", ret);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
500 ms |
114072 KB |
Output is correct |
2 |
Correct |
546 ms |
226304 KB |
Output is correct |
3 |
Correct |
538 ms |
220120 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
0 ms |
364 KB |
Output is correct |
5 |
Correct |
0 ms |
364 KB |
Output is correct |
6 |
Correct |
0 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
0 ms |
364 KB |
Output is correct |
5 |
Correct |
0 ms |
364 KB |
Output is correct |
6 |
Correct |
0 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
376 KB |
Output is correct |
9 |
Correct |
0 ms |
364 KB |
Output is correct |
10 |
Correct |
0 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
0 ms |
364 KB |
Output is correct |
5 |
Correct |
0 ms |
364 KB |
Output is correct |
6 |
Correct |
0 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
376 KB |
Output is correct |
9 |
Correct |
0 ms |
364 KB |
Output is correct |
10 |
Correct |
0 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
1 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
0 ms |
364 KB |
Output is correct |
5 |
Correct |
0 ms |
364 KB |
Output is correct |
6 |
Correct |
0 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
376 KB |
Output is correct |
9 |
Correct |
0 ms |
364 KB |
Output is correct |
10 |
Correct |
0 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
1 ms |
364 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
15 ms |
2540 KB |
Output is correct |
15 |
Correct |
15 ms |
2540 KB |
Output is correct |
16 |
Correct |
14 ms |
2540 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
476 ms |
117356 KB |
Output is correct |
2 |
Correct |
515 ms |
213620 KB |
Output is correct |
3 |
Correct |
526 ms |
208320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
500 ms |
114072 KB |
Output is correct |
2 |
Correct |
546 ms |
226304 KB |
Output is correct |
3 |
Correct |
538 ms |
220120 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
364 KB |
Output is correct |
6 |
Correct |
0 ms |
364 KB |
Output is correct |
7 |
Correct |
0 ms |
364 KB |
Output is correct |
8 |
Correct |
0 ms |
364 KB |
Output is correct |
9 |
Correct |
0 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
376 KB |
Output is correct |
12 |
Correct |
0 ms |
364 KB |
Output is correct |
13 |
Correct |
0 ms |
364 KB |
Output is correct |
14 |
Correct |
1 ms |
364 KB |
Output is correct |
15 |
Correct |
1 ms |
364 KB |
Output is correct |
16 |
Correct |
1 ms |
364 KB |
Output is correct |
17 |
Correct |
15 ms |
2540 KB |
Output is correct |
18 |
Correct |
15 ms |
2540 KB |
Output is correct |
19 |
Correct |
14 ms |
2540 KB |
Output is correct |
20 |
Correct |
476 ms |
117356 KB |
Output is correct |
21 |
Correct |
515 ms |
213620 KB |
Output is correct |
22 |
Correct |
526 ms |
208320 KB |
Output is correct |
23 |
Correct |
841 ms |
262144 KB |
Output is correct |
24 |
Correct |
762 ms |
262144 KB |
Output is correct |
25 |
Correct |
717 ms |
245020 KB |
Output is correct |