이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "trilib.h"
#include <bits/stdc++.h>
using namespace std;
int main() {
int N = get_n();
vector<int> city;
vector<int> left_city, right_city;
for (int i = 2; i <= N - 1; i++)
if (is_clockwise(1, i, N))
left_city.emplace_back(i);
else
right_city.emplace_back(i);
auto cmp = [&](int l, int r) { return is_clockwise(1, l, r); };
sort(left_city.begin(), left_city.end(), cmp);
sort(right_city.begin(), right_city.end(), cmp);
for (auto i : left_city) city.emplace_back(i);
city.emplace_back(N);
for (auto i : right_city) city.emplace_back(i);
vector<int> hull;
hull.emplace_back(1);
for (auto i : city) {
while (hull.size() >= 2 && !is_clockwise(hull[hull.size() - 2], hull[hull.size() - 1], i))
hull.pop_back();
hull.emplace_back(i);
}
while (hull.size() > 3) {
if (!is_clockwise(hull[hull.size() - 1], hull[0], hull[1]))
hull.erase(hull.begin());
else if (!is_clockwise(hull[hull.size() - 2], hull[hull.size() - 1], hull[0]))
hull.pop_back();
else
break;
}
give_answer(hull.size());
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... |