제출 #680179

#제출 시각아이디문제언어결과실행 시간메모리
680179jhwest2Triangles (CEOI18_tri)C++17
0 / 100
1 ms304 KiB
#include "trilib.h" #include <bits/stdc++.h> using namespace std; const int N = 40040; int n, inv[N]; int main() { n = get_n(); int u = 1, v = 2; vector<int> a, b; for (int i = 3; i <= n; i++) { if (!is_clockwise(u, v, i)) a.push_back(i); else b.push_back(i); } if (a.size() > b.size()) { swap(a, b); swap(u, v); } sort(a.begin(), a.end(), [&](int i, int j) { return !is_clockwise(u, i, j); }); deque<int> hull; hull.push_back(u); for (int x : a) { while (hull.size() >= 2) { if (!is_clockwise(hull[hull.size() - 2], hull.back(), x)) hull.pop_back(); else break; } hull.push_back(x); } hull.push_back(v); sort(b.begin(), b.end(), [&](int i, int j) { return is_clockwise(v, i, j); }); for (int x : b) { while (hull.size() >= 2) { if (!is_clockwise(hull[hull.size() - 2], hull.back(), x)) hull.pop_back(); else break; } hull.push_back(x); } for (int i = 0; i < N; i++) { int x = hull.front(); hull.pop_front(); while (hull.size() >= 2) { if (!is_clockwise(hull[hull.size() - 2], hull.back(), x)) hull.pop_back(); else break; } hull.push_back(x); } give_answer((int)hull.size()); }
#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...