이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "trilib.h"
#include <vector>
#include <algorithm>
#include <iostream>
#define int int64_t
using namespace std;
signed main()
{
int n = get_n();
vector<int> next(n, -1);
if (is_clockwise(1, 2, 3))
{
next[0] = 1;
next[1] = 2;
next[2] = 0;
}
else
{
next[0] = 2;
next[1] = 0;
next[2] = 1;
}
int start = 0;
for (int i = 3; i < n; i++)
{
int curr = -1;
while (curr != start)
{
if (curr == -1)
{
curr = start;
}
bool cl = is_clockwise(curr + 1, i + 1, next[curr] + 1);
if (cl)
{
next[i] = next[curr];
next[curr] = i;
while (true)
{
if (is_clockwise(i + 1, next[i] + 1, next[next[i]] + 1)) break;
else
{
int old = next[i];
next[i] = next[next[i]];
next[old] = -1;
if (old == start) start = i;
}
}
break;
}
else
{
curr = next[curr];
}
}
}
/*int curr = -1;
while (curr != start)
{
if (curr == -1) curr = start;
cout << curr << " ";
curr = next[curr];
}*/
int res = 0;
for (int i : next)
{
if (i != -1) res++;
}
give_answer(res);
}
# | 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... |