Run ID:3303

提交时间:2024-05-04 21:18:31

#include<bits/stdc++.h> using namespace std; struct rectangle{ int id; int lenth; int width; }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++) cin>>rec[i].id>>rec[i].lenth>>rec[i].width; 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) cout<<rec[i].id<<" "<<rec[i].lenth<<" "<<rec[i].width<<endl; return 0; }