# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
898119 | alexdd | Triangles (CEOI18_tri) | C++17 | 1 ms | 440 KiB |
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 n,centru;
bool cmp(int x, int y)
{
if(is_clockwise(centru,x,y))
return 1;
return 0;
}
signed main()
{
n = get_n();
centru=3;
vector<int> ord;
for(int i=1;i<=n;i++)
if(i!=centru)
ord.push_back(i);
sort(ord.begin(),ord.end(),cmp);
vector<int> hull;
hull.push_back(centru);
hull.push_back(ord[0]);
hull.push_back(ord[1]);
for(int i=2;i<ord.size();i++)
{
while((int)hull.size()>=2 && is_clockwise(ord[i],hull[(int)hull.size()-1],hull[(int)hull.size()-2]))
hull.pop_back();
hull.push_back(ord[i]);
}
give_answer(hull.size());
}
Compilation message (stderr)
# | 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... |