bzoj 1108

思路:水题, 将所有点按x轴对称反转,就变成了两堆点的坐标和的差。。

#include<bits/stdc++.h>
#define LL long long
#define fi first
#define se second
#define mk make_pair
#define pii pair<int,int>
#define piii pair<int, pair<int,int> >

using namespace std;

const int N = 50000 + 10;
const int M = 10 + 7;
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-7;

int n;
struct Point {
    int x, y;
} a[N], b[N];
int main() {

    scanf("%d", &n);
    LL ans = 0;
    for(int i = 1; i <= n; i++) {
        scanf("%d%d", &a[i].x, &a[i].y);
        ans += a[i].x;
        ans += (100000 - a[i].y);
    }

    for(int i = 1; i <= n; i++) {
        scanf("%d%d", &b[i].x, &b[i].y);
        ans -= b[i].x;
        ans -= (100000 - b[i].y);
    }

    printf("%lld\n", abs(ans));
    return 0;
}

 

posted @ 2018-06-16 20:36  NotNight  阅读(130)  评论(0编辑  收藏  举报