Submission #481199

#TimeUsernameProblemLanguageResultExecution timeMemory
481199hidden1Triangles (CEOI18_tri)C++14
0 / 100
1 ms332 KiB
#include <bits/stdc++.h> #include "trilib.h" using namespace std; //#pragma GCC optimize ("O3") //#pragma GCC target ("sse4") #ifndef LOCAL #define cerr if(false) cerr #endif #define endl "\n" #define all(x) (x).begin(), (x).end() #define forn(i, n) for(int i = 0; i < n; i ++) #define revn(i, n) for(int i = n - 1; i >= 0; i --) typedef long long ll; template<class T, template<class T2, class A=allocator<T2> > class cont> inline ostream &operator <<(ostream &out, const cont<T> &x) { for(const auto &it : x) { out << it << " ";} return out;} template<class T, template<class T2, class A=allocator<T2> > class cont> inline istream &operator >>(istream &in, cont<T> &x) { for(auto &it : x) { in >> it;} return in;} template<class T, class T2> inline ostream &operator <<(ostream &out, const pair<T, T2> &x) { out << x.first << " " << x.second; return out;} template<class T, class T2> inline istream &operator >>(istream &in, pair<T, T2> &x) { in >> x.first >> x.second; return in;} template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; } template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; } const ll mod = 1e9 + 7; signed main() { // ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; int special = 1; n = get_n(); vector<int> vert; forn(i, n) { if(i + 1 != special) { vert.push_back(i + 1); } } sort(all(vert), [&special](const int a, const int b) { return is_clockwise(special, a, b) == true; }); reverse(all(vert)); vert.push_back(special); reverse(all(vert)); vector<int> st; for(auto it : vert) { while(!(st.size() < 2) && !is_clockwise(st[st.size() - 2], st[st.size() - 1], it)) { st.pop_back(); } st.push_back(it); } int ret = st.size(); auto cpy = st; for(auto it : cpy) { while(!(st.size() < 2) && !is_clockwise(st[st.size() - 2], st[st.size() - 1], it)) { st.pop_back(); ret --; } st.push_back(it); } give_answer(ret); 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...