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;
bool ask(int a, int b, int c) {
return is_clockwise(a, b, c);
}
int main() {
int N = get_n();
vector <int> cand, hull;
for(int i = 1; i <= N; i++) {
cand.push_back(i);
}
sort(cand.begin() + 1, cand.end(), [&](const int &a, const int &b) {
return ask(1, a, b) == false;
});
for(auto p : cand) {
while(hull.size() >= 2 and ask(hull[hull.size() - 2], hull.back(), p) == true) {
hull.pop_back();
}
hull.push_back(p);
}
cand.pop_back();
reverse(cand.begin(), cand.end());
int len = hull.size();
for(auto p : cand) {
while(hull.size() > len and ask(hull[hull.size() - 2], hull.back(), p) == true) {
hull.pop_back();
}
hull.push_back(p);
}
hull.pop_back();
give_answer(hull.size());
return 0;
}
Compilation message (stderr)
tri.cpp: In function 'int main()':
tri.cpp:33:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
33 | while(hull.size() > len and ask(hull[hull.size() - 2], hull.back(), p) == true) {
| ~~~~~~~~~~~~^~~~~
# | 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... |