提交时间:2024-05-18 17:08:01
运行 ID: 147645
#include<iostream> #include<string> #include<algorithm> using namespace std; struct Person{ string name; int year,month,date; }a[100100]; int main(){ int n; cin>>n; for(int i = 0; i < n; i++){ cin>>a[i].name>>a[i].year>>a[i].month>>a[i].date; } sort(a,a+n,[](Person a,Person b){ if(a.year != b.year){ return a.year < b.year; } else if(a.month != b.month){ return a.month < b.month; } else if(a.date != b.date){ return a.date < b.date; } return true; }); for(int i = 0; i < n; i++){ cout<<a[i].name<<'\n'; } return 0; }