제출 #236399

#제출 시각아이디문제언어결과실행 시간메모리
236399super_j6Triangles (CEOI18_tri)C++14
100 / 100
31 ms2176 KiB
#include "trilib.h" #include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <deque> using namespace std; #define endl '\n' #define ll long long #define pi pair<int, int> #define f first #define s second int n; vector<int> a[2]; deque<int> v; int main(){ ios::sync_with_stdio(0); cin.tie(0); n = get_n(); a[0] = {1, 2}; for(int i = 3; i <= n; i++){ a[is_clockwise(1, 2, i)].push_back(i); } n = 0; for(int t = 0; t < 2; t++){ sort(a[t].begin() + !t, a[t].end(), [&](int x, int y){ return is_clockwise(1, x, y); }); for(int i : a[t]){ while(n > 1 && !is_clockwise(v[n - 2], v[n - 1], i)) v.pop_back(), n--; v.push_back(i), n++; } } hell: if(n > 2 && !is_clockwise(v[n - 2], v[n - 1], v[0])){ v.pop_back(), n--; goto hell; } if(n > 2 && is_clockwise(v[1], v[0], v[n - 1])){ v.pop_front(), n--; goto hell; } give_answer(n); 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...