#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
struct queue
{
int x, y, index;
bool operator()(queue a, queue b)
{
if(a.x < b.x)return 1;
if(a.x == b.x && a.y < b.y)return 1;
return 0;
}
}list[901];
int main()
{
int n;
cin >> n;
n*=3;
int i,j;
for(i=0;i<n;i++)
{
cin >> list[i].x >> list[i].y;
list[i].index = i+1;
}
std::sort(list,list+n,queue());
int visit[901]={0,};
for(int t=0;t<n/3;t++)
{
int ans=0;
for(i=0;i<n;i++)
{
if(visit[i])continue;
for(j=i+1;j<n;j++)
{
if(visit[j])continue;
for(int k=j+1;k<n;k++)
{
if(visit[k])continue;
cout << list[i].index << " " << list[j].index << " " << list[k].index << endl;
visit[i]=1;
visit[j]=1;
visit[k]=1;
ans=1;
break;
}
if(ans)break;
}
if(ans)break;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1684 KB |
Output is correct |
2 |
Correct |
0 ms |
1684 KB |
Output is correct |
3 |
Correct |
0 ms |
1684 KB |
Output is correct |
4 |
Correct |
0 ms |
1684 KB |
Output is correct |
5 |
Correct |
0 ms |
1684 KB |
Output is correct |
6 |
Correct |
0 ms |
1684 KB |
Output is correct |
7 |
Correct |
0 ms |
1684 KB |
Output is correct |
8 |
Correct |
0 ms |
1684 KB |
Output is correct |
9 |
Correct |
0 ms |
1684 KB |
Output is correct |
10 |
Correct |
0 ms |
1684 KB |
Output is correct |
11 |
Correct |
0 ms |
1684 KB |
Output is correct |
12 |
Correct |
0 ms |
1684 KB |
Output is correct |
13 |
Correct |
0 ms |
1684 KB |
Output is correct |
14 |
Correct |
0 ms |
1684 KB |
Output is correct |
15 |
Correct |
0 ms |
1684 KB |
Output is correct |
16 |
Correct |
0 ms |
1684 KB |
Output is correct |
17 |
Correct |
0 ms |
1684 KB |
Output is correct |
18 |
Correct |
0 ms |
1684 KB |
Output is correct |
19 |
Correct |
0 ms |
1684 KB |
Output is correct |
20 |
Correct |
0 ms |
1684 KB |
Output is correct |