1 条题解

  • 0
    @ 2026-3-20 13:58:37
    #include <bits/stdc++.h>
    using namespace std;
    
    int main() {
    	ios::sync_with_stdio(false); cin.tie(nullptr);
    	int n; cin >> n;
    	vector<pair<int, int>> a(n);
    	for (int i = 0; i < n; i ++) cin >> a[i].first >> a[i].second;
    	sort(a.begin(), a.end(), [](pair<int, int> x, pair<int, int> y) {
    		if (x.second != y.second) return x.second < y.second;
    		return x.first > y.first;
    	});
    	for (int i = 0; i < n; i ++)
    		cout << a[i].first << ' ' << a[i].second << '\n';
    	return 0;
    }
    
    • 1

    信息

    ID
    211
    时间
    1000ms
    内存
    256MiB
    难度
    6
    标签
    (无)
    递交数
    38
    已通过
    12
    上传者