이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "trilib.h"
using namespace std;
int n, origin;
vector<int> arr;
bool compare(int i, int j) {
    return is_clockwise(i, origin, j);
}
void solve() {
    n = get_n();
    int k = 1, l = 2, t = 0;
    while (++t) {
        bool f = false;
        for (int i = 1; i <= n; i++) {
            if (i != k && i != l) {
                if (is_clockwise(k, l, i)) {
                    f = true;
                    if (t % 2 == 1) k = i;
                    else l = i;
                    break;
                }
            }
        }
        if (!f) break;
    }
    origin = k;
    for (int i = 1; i <= n; i++) if (i != origin) arr.push_back(i);
    sort(arr.begin(), arr.end(), compare);
    stack<int> stk;
    stk.push(origin);
    stk.push(arr[0]);
    for (int i = 1; i <= n; i++) {
        int a = stk.top(); stk.pop();
        while (stk.size() >= 2 && !is_clockwise(stk.top(), a, i)) {
            stk.top() = a; stk.pop();
        }
        stk.push(a);
        stk.push(i);
    }
    give_answer(stk.size());
}
int main() {
    solve();
}
| # | 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... |