#include<bits/stdc++.h>
#include "trilib.h"
using namespace std;
#define inf 5e18
#define nl '\n'
bool cmp(int a, int b){
return is_clockwise(1, a, b);
}
vector<int> func(vector<int>& v){
sort(v.begin(), v.end(), cmp);
vector<int> ans;
ans.push_back(1);
for(int x : v){
while(ans.size() >= 2 and !is_clockwise(ans[ans.size()-2], ans.back(), x)) ans.pop_back();
ans.push_back(x);
}
return ans;
}
inline void solve(){
int n = get_n();
vector<int> a{2}, b{2};
for(int i=3; i<=n; i++){
(is_clockwise(1, 2, i) ? b : a).push_back(i);
}
a = func(a);
int sa = a.size();
b = func(b);
int sb = b.size();
int ans = sa + sb - 2;
if(min(sa, sb) > 2 and is_clockwise(b[sb-1], a[1], 1)) ans--;
if(min(sa, sb) > 2 and !is_clockwise(b[2], a[sa-2], 2)) ans--;
give_answer(ans);
}
signed main(){
int t = 1;
//cin>>t;
while(t--) solve();
return 0;
}
# | 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... |