提交时间:2024-08-19 15:00:02
运行 ID: 166616
#include <iostream> #include <algorithm> using namespace std; struct man { int w,s; }a[100001]; bool cmp(man x,man y) { if (x.w != y.w) return x.w < y.w; return x.s < y.s; } int main() { int n; cin >> n; for (int i = 1 ; i <= n ; i ++) cin >> a[i].w >> a[i].s; sort(a + 1,a + n + 1,cmp); for (int i = 1 ; i <= n ; i ++) cout << a[i].w << " " << a[i].s << endl; }