#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
typedef struct point{
int x;
int y;
int idx;
} point;
point a[300];
int compare(point p1, point p2)
{
if(p1.x==p2.x) return (p1.y<p2.y);
else return (p1.x<p2.x);
}
int ccw(point A, point B, point C)
{
return (A.x * B.y + B.x * C.y + C.x * A.y) - (A.x * C.y + B.x * A.y + C.x * B.y);
}
bool compare2(point p1, point p2)
{
if(0<ccw(a[0],p1,p2)) return true;
else return false;
}
int main()
{
int n,i;
cin>>n;
n=n*3;
for(i=0;i<n;i++)
{
cin>>a[i].x>>a[i].y;
a[i].idx=i+1;
}
for(i=0;i<n;i+=3)
{
sort(a+i,a+n,compare);
sort(a+1+i,a+n,compare2);
cout<<a[i].idx<<' '<<a[i+1].idx<<' '<<a[i+2].idx<<'\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1680 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |