Advertisement

CSP试题回顾202009-1 检测点查询(优化)

阅读量:

CSP-202009-1-称检测点查询

解题代码实现

复制代码
    #include <iostream>
    #include <vector>
    #include <algorithm>
    using namespace std;
    
    struct MyDistance
    {
    long long index, distance;
    };
    
    bool cmp(MyDistance& a, MyDistance& b) {
    if (a.distance == b.distance) return a.index < b.index;
    return a.distance < b.distance;
    }
    
    long long n, X, Y, x, y;
    
    int main() {
    cin >> n >> X >> Y;
    vector<MyDistance>list(n);
    for (size_t i = 0; i < n; i++)
    {
        cin >> x >> y;
        list[i].index = 

全部评论 (0)

还没有任何评论哟~