### 思路
1. **读取输入**:读取点集的个数和每个点的坐标。
2. **排序**:按照 X 轴从大到小排序,如果 X ���相同则按 Y 轴从小到大排序。
3. **筛选“最大”点**:从排序后的点集中筛选出“最大”点,确保每个点的 Y 轴值大于等于之前的点的 Y 轴值。
4. **输出结果**:按照 X 轴从小到大的顺序输出筛选出的“最大”点。
### 伪代码
1. 读取输入点集的个数 N。
2. 读取 N 个点的坐标。
3. 按照 X 轴从大到小排序,如果 X 轴相同则按 Y 轴从小到大排序。
4. 初始化一个空列表用于存储“最大”点。
5. 遍历排序后的点集,筛选出“最大”点。
6. 按照 X 轴从小到大的顺序输出筛选出的“最大”点。
### C++代码
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Point {
int x, y;
};
bool compare(const Point &a, const Point &b) {
if (a.x == b.x) return a.y < b.y;
return a.x > b.x;
}
int main() {
int N;
cin >> N;
vector<Point> points(N);
for (int i = 0; i < N; ++i) {
cin >> points[i].x >> points[i].y;
}
sort(points.begin(), points.end(), compare);
vector<Point> result;
int maxY = -1;
for (const auto &point : points) {
if (point.y > maxY) {
result.push_back(point);
maxY = point.y;
}
}
sort(result.begin(), result.end(), [](const Point &a, const Point &b) {
return a.x < b.x;
});
for (const auto &point : result) {
cout << point.x << " " << point.y << endl;
}
return 0;
}