This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "trilib.h"
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n = get_n();
vector<vector<int>> pts(2);
for (int i = 3; i <= n; i++) {
pts[!is_clockwise(1, 2, i)].push_back(i);
}
pts[1].push_back(2);
for (int it = 0; it < 2; it++) {
sort(pts[it].begin(), pts[it].end(), [&](int i, int j) {
if (i == j) {
return false;
}
return !is_clockwise(1, i, j);
});
}
vector<int> v;
for (int i : pts[1]) {
v.push_back(i);
}
v.push_back(1);
for (int i : pts[0]) {
v.push_back(i);
}
vector<int> res;
int bef = 0;
for (int it = 0; it < 2; it++) {
bef = (int) res.size();
for (int i : v) {
while (res.size() >= 2 && is_clockwise(res.rbegin()[1], res.back(), i)) {
res.pop_back();
}
res.push_back(i);
}
}
cout << (int) res.size() - bef << endl;
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... |