Submission #1202529

#TimeUsernameProblemLanguageResultExecution timeMemory
1202529loomTriangles (CEOI18_tri)C++20
20 / 100
0 ms328 KiB
#include<bits/stdc++.h> #include "trilib.h" using namespace std; #define inf 5e18 #define nl '\n' int p = 2; bool cmp(int a, int b){ return is_clockwise(p, a, b); } inline void solve(){ int n = get_n(); for(int i=3; i<=n; i++){ if(is_clockwise(1, p, i)) p = i; } vector<int> v; for(int i=1; i<=n; i++) if(i != p) v.push_back(i); sort(v.begin(), v.end(), cmp); deque<int> ans; ans.push_back(p); 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); } while(!is_clockwise(ans.back(), ans[0], ans[1])) ans.pop_front(); while(!is_clockwise(ans[ans.size()-2], ans.back(), ans[0])) ans.pop_back(); give_answer(ans.size()); } signed main(){ int t = 1; //cin>>t; while(t--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...