思维,
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int n=1e6+11;
int a,b[n],c[n],d,k[n];
struct s
{
int x,y,z;
}q[n];
bool cmp(s a1,s a2)
{
return a1.z<a2.z;
}
signed main()
{
cin>>a;
for(int i=1;i<=a*2;i++)
{
cin>>q[i].x;
}
for(int i=1;i<=a*2;i++)
{
cin>>q[i].y;
q[i].z=q[i].x+q[i].y;
}
sort(q+1,q+1+a*2,cmp);
int w=0;
for(int i=1;i<=a*2;i++)
{
// cout<<q[i].z<<endl;
if(i%2==1)
{
w+=q[i].x;
}
else
w-=q[i].y;
}
cout<<w<<endl;
}