Run ID:3322

提交时间:2024-05-17 15:57:25

#include<bits/stdc++.h> using namespace std; struct rectangle{ int id,lenth,width; void input(){ cin>>id>>lenth>>width; }void output(){ cout<<id<<" "<<lenth<<" "<<width<<endl; } }rec[1000]; bool cmp(rectangle a,rectangle b){ if(a.id!=b.id) return a.id<b.id; else if(a.lenth!=b.lenth) return a.lenth<b.lenth; else return a.width<b.width; } int main(){ int n; cin>>n; for(int i=0;i<n;i++) rec[i].input(); sort(rec,rec+n,cmp); for(int i=0;i<n;i++) if(rec[i-1].id!=rec[i].id||rec[i-1].lenth!=rec[i].lenth||rec[i-1].width!=rec[i].width||i==0) rec[i].output(); return 0; }