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 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(pi > 0 && 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 |
---|
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... |