UVA - 1595 Symmetry 【暴力】

#include<iostream>
#include<set>
#include<algorithm>
using namespace std;
typedef pair<int, int> point;
int main()
{
    int T;
    cin >> T;
    while(T--)
    {
        int n; cin >> n;
        int Min = 10005, Max = -10005;
        set<point>s;
        for (int i = 0; i < n; i++)
        {
            int x, y;
            cin >> x >> y;
            Min = min(x, Min);
            Max = max(x, Max);
            s.insert(point(x, y));
        }
        int ans = (Max + Min);
        bool flag = false;
        for (set<point>::iterator it = s.begin(); it != s.end(); it++)
        {
            point i = *it;
            if(!s.count(point(ans - i.first, i.second)))
            {
                flag = true;
                break;
            }
        }
        if(flag) cout << "NO" <<endl;
        else cout << "YES" <<endl;
    }
}

猜你喜欢

转载自blog.csdn.net/qq_37602930/article/details/80079824