Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
193915 luckypet 双关键字排序 C++ 运行超时 80 1000 MS 1036 KB 588 2025-05-27 15:27:13

Tests(4/5):


#include <iostream> #include <vector> #include <algorithm> using namespace std; struct Pair { int a, b; }; bool compare(const Pair& p1, const Pair& p2) { if (p1.a != p2.a) { return p1.a < p2.a; } return p1.b < p2.b; } int main() { int n; cin >> n; vector<Pair> pairs(n); for (int i = 0; i < n; ++i) { cin >> pairs[i].a >> pairs[i].b; } sort(pairs.begin(), pairs.end(), compare); for (const auto& p : pairs) { cout << p.a << " " << p.b << endl; } return 0; }


测评信息: