#include <stdio.h>
#include <algorithm>
#include <math.h>
#define inf 0x7fffffff
#define pi 3.141592653589793238
using namespace std;
typedef pair <int,int> ppair;
typedef pair <ppair,int> pppair;
pair <double,pppair> p[901];
int N;
void input(void)
{
int i, x, y, minx=inf, miny=inf;
scanf("%d",&N);
for(i=1 ; i<=3*N ; i++)
{
scanf("%d %d",&x,&y);
p[i]=make_pair(0,make_pair(make_pair(x,y),i));
if(miny>y)
{
miny=y;
minx=x;
}
else if(miny==y)
if(minx>x)
minx=x;
}
for(i=1 ; i<=3*N ; i++)
p[i].first=atan2(p[i].second.first.second-miny,p[i].second.first.first-minx);
sort(p+1,p+3*N+1);
}
void output(void)
{
int i;
for(i=0 ; i<N ; i++)
printf("%d %d %d\n",p[3*i+1].second.second,p[3*i+2].second.second,p[3*i+3].second.second);
}
int main(void)
{
input();
output();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1332 KB |
Output is correct |
2 |
Correct |
0 ms |
1332 KB |
Output is correct |
3 |
Correct |
0 ms |
1332 KB |
Output is correct |
4 |
Correct |
0 ms |
1332 KB |
Output is correct |
5 |
Correct |
0 ms |
1332 KB |
Output is correct |
6 |
Correct |
0 ms |
1332 KB |
Output is correct |
7 |
Correct |
0 ms |
1332 KB |
Output is correct |
8 |
Correct |
0 ms |
1332 KB |
Output is correct |
9 |
Correct |
0 ms |
1332 KB |
Output is correct |
10 |
Correct |
0 ms |
1332 KB |
Output is correct |
11 |
Correct |
0 ms |
1332 KB |
Output is correct |
12 |
Correct |
0 ms |
1332 KB |
Output is correct |
13 |
Correct |
0 ms |
1332 KB |
Output is correct |
14 |
Correct |
0 ms |
1332 KB |
Output is correct |
15 |
Correct |
0 ms |
1332 KB |
Output is correct |
16 |
Correct |
0 ms |
1332 KB |
Output is correct |
17 |
Correct |
0 ms |
1332 KB |
Output is correct |
18 |
Correct |
0 ms |
1332 KB |
Output is correct |
19 |
Correct |
0 ms |
1332 KB |
Output is correct |
20 |
Correct |
0 ms |
1332 KB |
Output is correct |