Pagini recente » Cod sursa (job #2781300) | Cod sursa (job #132822) | Cod sursa (job #289735) | Cod sursa (job #18088) | Cod sursa (job #2612926)
#include <iostream>
#include <fstream>
#include <algorithm>
#define NMAX 50000
std::ifstream fin ( "tribute.in" );
std::ofstream fout ( "tribute.out" );
int l[1 + NMAX];
int c[1 + NMAX];
int main ( ) {
int N, DX, DY;
fin >> N >> DX >> DY;
for ( int i = 1; i <= N; ++i )
fin >> l[i] >> c[i];
std::sort ( l + 1, l + N + 1 );
std::sort ( c + 1, c + N + 1 );
int ans = 0;
for ( int i = 1; i <= N / 2; ++i ) {
ans += std::max ( l[N - i + 1] - l[i] - DX, 0 );
ans += std::max ( c[N - i + 1] - c[i] - DY, 0 );
}
fout << ans << '\n';
return 0;
}