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 "trilib.h"
#include <iostream>
#include <assert.h>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;
void getConvexHull(){
int n = get_n();
vector<int> v(n - 1, 0);
iota(v.begin(), v.end(), 2);
stable_sort(v.begin(), v.end(), [&](int a, int b){
return is_clockwise(1, a, b);
});
vector<int> ch;
ch.push_back(1); ch.push_back(v[0]);
for(int i = 1; i < v.size(); i ++){
while(ch.size() >= 2 && !is_clockwise(ch[ch.size() - 2], ch.back(), v[i])) ch.pop_back();
ch.push_back(v[i]);
}
give_answer(ch.size());
}
int main(){
getConvexHull();
}
Compilation message (stderr)
tri.cpp: In function 'void getConvexHull()':
tri.cpp:21:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
21 | for(int i = 1; i < v.size(); i ++){
| ~~^~~~~~~~~~
# | 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... |