点击打开链接
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<string.h>
#include<set>
#include<algorithm>
using namespace std;
struct Node
{
int num, len, wid;
};
set<Node>s;
bool operator<(Node x, Node y)
{
return x.num<y.num || x.num == y.num && x.len<y.len || x.num == y.num&&x.len == y.len &&x.wid<y.wid;
}
int main()
{
int n, m, a, b, c;
scanf("%d", &n);
while (n--)
{
scanf("%d", &m);
while (m--)
{
scanf("%d%d%d", &a, &b, &c);
Node temp;
if (b<c)
{
temp.num = a, temp.len = c, temp.wid = b;
s.insert(temp);
}
else
{
temp.num = a, temp.len = b, temp.wid = c;
s.insert(temp);
}
}
set<Node>::iterator it;
for (it = s.begin(); it != s.end(); it++)
{
printf("%d %d %d\n",it->num,it->len,it->wid);
}
s.clear();
}
return 0;
}