Pagini recente » Cod sursa (job #687701) | Cod sursa (job #1086694) | Cod sursa (job #2629479) | Cod sursa (job #2861075) | Cod sursa (job #2782573)
#include <fstream>
#include <algorithm>
using namespace std;
ifstream cin ( "tribute.in" );
ofstream cout ( "tribute.out" );
#define NMAX 50000
int x[NMAX], y[NMAX];
int main() {
int n, dx, dy, i, j;
long long ans;
cin >> n >> dx >> dy;
for ( i = 0; i < n; i++ ) {
cin >> x[i] >> y[i];
}
sort ( x, x + n );
sort ( y, y + n );
ans = 0;
for ( i = 0, j = n - 1; i < j; ) {
if ( x[j] - x[i] - dx ) {
ans += (long long)x[j] - x[i] - dx;
}
if ( y[j] - y[i] - dy ) {
ans += (long long)y[j] - y[i] - dy;
}
i++;
j--;
}
cout << ans;
return 0;
}