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<bits/stdc++.h>
using namespace std;
vector<int> lower,upper;
deque<int> hull;
set<int> ans;
bool cmp(int x,int y){
return is_clockwise(1,x,y);
}
void upd(int x){
while(hull.size()>1&&!is_clockwise(hull.end()[-2],hull.back(),x))hull.pop_back();
hull.emplace_back(x);
}
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
int n;
n=get_n();
for(int i=3;i<=n;i++){
if(is_clockwise(1,2,i))upper.emplace_back(i);
else lower.emplace_back(i);
}
sort(lower.begin(),lower.end(),cmp);
sort(upper.begin(),upper.end(),cmp);
upd(1);
for(auto x:lower)upd(x);
upd(2);
for(auto x:upper)upd(x);
int res=hull.size();
for(int i=0;i<res;i++){
upd(hull[0]);
hull.pop_front();
}
give_answer(hull.size());
}
# | 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... |