#include <iostream>
using namespace std;
#define MAXN 300
void swap(int &a,int &b)
{
int t=a;
a=b;
b=t;
}
int main()
{
int n;
int x[MAXN*3];
int y[MAXN*3];
int no[MAXN*3];
cin >> n;
for(int i=0;i<n*3;i++)
{
cin >> x[i] >> y[i];
no[i]=i;
}
for(int i=0;i<n*3;i++)
for(int j=i+1;j<n*3;j++)
if(y[i]>y[j])
{
swap(x[i],x[j]);
swap(y[i],y[j]);
swap(no[i],no[j]);
}
for(int i=0;i<n*3;i++)
for(int j=i+1;j<n*3;j++)
if(x[i]>x[j])
{
swap(x[i],x[j]);
swap(y[i],y[j]);
swap(no[i],no[j]);
}
for(int i=1;i<=n*3;i++)
{
cout << no[i-1]+1 << " ";
if(i%3==0)
cout << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1672 KB |
Output is correct |
2 |
Correct |
0 ms |
1672 KB |
Output is correct |
3 |
Correct |
0 ms |
1672 KB |
Output is correct |
4 |
Correct |
0 ms |
1672 KB |
Output is correct |
5 |
Correct |
0 ms |
1672 KB |
Output is correct |
6 |
Correct |
4 ms |
1672 KB |
Output is correct |
7 |
Correct |
0 ms |
1672 KB |
Output is correct |
8 |
Correct |
0 ms |
1672 KB |
Output is correct |
9 |
Correct |
4 ms |
1672 KB |
Output is correct |
10 |
Correct |
4 ms |
1672 KB |
Output is correct |
11 |
Correct |
4 ms |
1672 KB |
Output is correct |
12 |
Correct |
0 ms |
1672 KB |
Output is correct |
13 |
Correct |
4 ms |
1672 KB |
Output is correct |
14 |
Correct |
4 ms |
1672 KB |
Output is correct |
15 |
Correct |
4 ms |
1672 KB |
Output is correct |
16 |
Correct |
4 ms |
1672 KB |
Output is correct |
17 |
Correct |
4 ms |
1672 KB |
Output is correct |
18 |
Correct |
4 ms |
1672 KB |
Output is correct |
19 |
Correct |
4 ms |
1672 KB |
Output is correct |
20 |
Correct |
4 ms |
1672 KB |
Output is correct |