Cod sursa(job #2327576)
| Utilizator | Data | 24 ianuarie 2019 19:30:13 | |
|---|---|---|---|
| Problema | Tribute | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.38 kb |
#include<fstream>
#include<algorithm>
using namespace std;
int x,y,a[50010],b[50010],rez,n;
ifstream cin ("tribute.in");
ofstream cout ("tribute.out");
int main(){
cin >>n>>x>>y;
for (int i = 0; i<n; i++)cin >>a[i]>>b[i];
sort(a,a+n);
sort(b,b+n);
for (int i = 0, j = n-1; j >=0 && i<n; i++, j--){
rez+=max(a[i]-a[j]-x,0);
rez+=max(b[i]-b[j]-y,0);
}
cout << rez;
}
