Pagini recente » Cod sursa (job #111665) | Cod sursa (job #1689674) | Cod sursa (job #2845176) | Cod sursa (job #2638964) | Cod sursa (job #2782572)
#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, ans, i, j;
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; i++, j-- ) {
if ( x[j] - x[i] - dx ) {
ans += x[j] - x[i] - dx;
}
if ( y[j] - y[i] - dy ) {
ans += y[j] - y[i] - dy;
}
}
cout << ans;
return 0;
}