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>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int* x = new int[n];
int* y = new int[n];
vector<int> s;
for (int i = 0; i < n; i++)
{
cin >> x[i] >> y[i];
while (!s.empty() && x[i] - x[s.back()] <= y[i] - y[s.back()])
{
s.pop_back();
}
if (s.empty() || x[i] - x[s.back()] > y[s.back()] - y[i])
{
s.push_back(i);
}
}
cout << s.size() << endl;
cin >> 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... |