Cod sursa(job #1096180)
| Utilizator | Data | 1 februarie 2014 17:23:05 | |
|---|---|---|---|
| Problema | Tribute | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <algorithm>
#include <cstdio>
using namespace std;
const int N=50005;
int a[N], b[N];
int main()
{
freopen("tribute.in", "r", stdin);
freopen("tribute.out", "w", stdout);
int n, dx, dy, i, sol=0;
scanf("%d%d%d", &n, &dx, &dy);
for(i=1;i<=n;i++) scanf("%d%d", &a[i], &b[i]);
sort(a+1, a+n+1);
sort(b+1, b+n+1);
for(i=1;i<=n/2;i++) sol+=max(a[n-i+1]-a[i]-dx, 0)+max(b[n-i+1]-b[i]-dy, 0);
printf("%d", sol);
}
