Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //UVA1595Symmetry
- #include<cstdio>
- #include<iostream>
- #include<map>
- #include<string>
- #include<cstring>
- using namespace std;
- const int MAXN = 2000;
- typedef pair<double, double> LL;
- LL dot_pair[MAXN];
- map<LL, int> Match;
- int main() {
- int kase = 0;
- scanf("%d", &kase);
- while(kase--) {
- int n = 0;
- scanf("%d", &n);
- double sum = 0;
- for(int i = 0; i < n; i++) {
- double a, b;
- scanf("%lf%lf", &a, &b);
- dot_pair[i].first = a;
- //printf("a = %.0f\n", a);
- sum += a;
- dot_pair[i].second = b;
- Match[dot_pair[i]] = 1;
- }
- double aver = sum / n;
- //printf("aver = %.0lf\n", aver);
- int i = 0;
- for(i = 0; i < n; i++) {
- double a = 2 * aver - dot_pair[i].first;
- double b = dot_pair[i].second;
- LL tmp_pair(a, b);
- // printf("i = %d : (%.0lf, %.0lf) (%.0lf, %.0lf)\n", i, dot_pair[i].first, dot_pair[i].second, tmp_pair.first, tmp_pair.first);
- if(!Match.count(tmp_pair)) break;
- }
- puts(i == n ? "YES" : "NO");
- }
- return 0;
- }
- /*
- 3
- 5
- -2 5
- 0 0
- 6 5
- 4 0
- 2 3
- 4
- 2 3
- 0 4
- 4 0
- 0 0
- 4
- 5 14
- 6 10
- 5 10
- 6 14
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement