#include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 11;
int p[N][2], pi = 0;
int main(){
cin.tie(0); cout.tie(0)->sync_with_stdio(false);
int n; cin >> n;
for(int i = 0; i < n; i++){
int x, y; cin >> x >> y;
while(pi > 0 && abs(p[pi - 1][0] - x) <= y - p[pi - 1][1]) pi--;
if(abs(p[pi - 1][0] - x) <= p[pi - 1][1] - y) continue;
p[pi][0] = x, p[pi][1] = y; pi++;
}
cout << pi << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1303 ms |
160624 KB |
Output is correct |
2 |
Correct |
1319 ms |
188172 KB |
Output is correct |
3 |
Correct |
1290 ms |
183048 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1422 ms |
122596 KB |
Output is correct |
2 |
Correct |
1434 ms |
137384 KB |
Output is correct |
3 |
Correct |
1432 ms |
132220 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1303 ms |
160624 KB |
Output is correct |
2 |
Correct |
1319 ms |
188172 KB |
Output is correct |
3 |
Correct |
1290 ms |
183048 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |