//例题7.3 Seniors gun
int compare(int x,int y){
    return x>y;
}

int main(){
    int cases,n,m;
    scanf("%d",&cases);
    for(int c=0;c<cases;c++){
        int sum=0;
        scanf("%d%d",&n,&m);
        int gun[n];
        int monster[m];
        for(int ni=0;ni<n;ni++){
            scanf("%d",&gun[ni]);
        }
        for(int mi=0;mi<n;mi++){
            scanf("%d",&monster[mi]);
        }
        sort(gun,gun+n,compare);
        sort(monster,monster+m);
        int i=0;
        while(i<n&&gun[i]>monster[i]){
            sum=sum+gun[i]-monster[i];
            i++;
        }
        cout<<sum<<endl;
    }
    return 0;
}

拿到机试指南的第一天就被薛杰杰这个名字可爱到了!