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 <iostream>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
using namespace std;
using pii = pair<int, int>;
#define sz(x) int(x.size())
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N;
cin >> N;
vector<int> P;
int x[1+N], y[1+N];
cin >> x[1] >> y[1];
P.push_back(1);
for(int i = 2; i <= N; i++)
{
cin >> x[i] >> y[i];
if(abs(x[i] - x[P.back()]) <= y[P.back()] - y[i]) continue;
while(!P.empty() && abs(x[P.back()] - x[i]) <= y[i] - y[P.back()])
P.pop_back();
P.push_back(i);
}
cout << sz(P) << '\n';
}
# | 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... |