Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
134232 曾煦翔 双关键字排序 C++ 通过 100 413 MS 1028 KB 406 2024-03-02 15:14:13

Tests(5/5):


#include <bits/stdc++.h> using namespace std; const int N = 1e5; struct node { int p , q; }a[N]; bool cmp(node x , node y) { if(x.p != y.p) return x.p < y.p; return x.q < y.q; } int main() { int n; cin >> n; for(int i =1 ;i <= n;i++) cin >> a[i].p >> a[i].q; sort(a + 1 , a + n + 1,cmp); for(int i = 1;i <= n;i++) cout << a[i].p << " " << a[i].q << endl; return 0; }


测评信息: