#include<cstdio>
int x[900];
int y[900];
bool no[900];
int main()
{
double t;
int bot;
int i,j,k,n;
scanf("%d",&n);
for(i=0;i<n*3;i++)scanf("%d%d",&x[i],&y[i]);
j=0;
for(i=1;i<n*3;i++)
{
if(y[i]<y[j])
j=i;
}
printf("%d ",j+1);
no[j]=true;
bot=j;
for(i=1;i<n*3;i++)
{
for(k=0;no[k];k++);
for(j=k+1;j<n*3;j++)
{
if(no[j])continue;
if(1LL*(x[j]-x[bot])*(y[k]-y[bot])<1LL*(x[k]-x[bot])*(y[j]-y[bot]))
k=j;
}
printf("%d ",k+1);
no[k]=true;
if(i%3==2)puts("");
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1096 KB |
Output is correct |
2 |
Correct |
0 ms |
1096 KB |
Output is correct |
3 |
Correct |
0 ms |
1096 KB |
Output is correct |
4 |
Correct |
0 ms |
1096 KB |
Output is correct |
5 |
Correct |
0 ms |
1096 KB |
Output is correct |
6 |
Correct |
0 ms |
1096 KB |
Output is correct |
7 |
Correct |
0 ms |
1096 KB |
Output is correct |
8 |
Correct |
0 ms |
1096 KB |
Output is correct |
9 |
Correct |
4 ms |
1096 KB |
Output is correct |
10 |
Correct |
4 ms |
1096 KB |
Output is correct |
11 |
Correct |
4 ms |
1096 KB |
Output is correct |
12 |
Correct |
4 ms |
1096 KB |
Output is correct |
13 |
Correct |
4 ms |
1096 KB |
Output is correct |
14 |
Correct |
4 ms |
1096 KB |
Output is correct |
15 |
Correct |
4 ms |
1096 KB |
Output is correct |
16 |
Correct |
4 ms |
1096 KB |
Output is correct |
17 |
Correct |
4 ms |
1096 KB |
Output is correct |
18 |
Correct |
4 ms |
1096 KB |
Output is correct |
19 |
Correct |
4 ms |
1096 KB |
Output is correct |
20 |
Correct |
4 ms |
1096 KB |
Output is correct |