# 3504. 打工是不可能打工的

#include <algorithm>
#include <cstdint>
#include <cstdio>
#include <functional>

uint32_t n;
uint64_t b;
uint64_t a[200000];

int main() {
scanf("%u", &n);
for (uint32_t i = 0; i < n; ++i) {
scanf("%llu", &a[i]);
}
for (uint32_t i = 0; i < n; ++i) {
uint64_t temp;
scanf("%llu", &temp);
b += temp;
}
std::sort(a, a + n, std::greater<uint64_t>());
uint64_t sum = 0;
uint32_t cnt = 0;
for (uint32_t i = 0; i < n; ++i) {
sum += a[i];
++cnt;
if (sum >= b) {
printf("%u\n", cnt);
return 0;
}
}
printf("Game Over!\n");
}


long就够了

### include

int compare (const void * a, const void * b);

int main()
{
long long earn=0,spend=0;
int n,flag=0;
scanf(“%d”,&n);
int a[n],b[n];

for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}

for(int i=0;i<n;i++){
scanf("%d",&b[i]);
spend+=b[i];
}

qsort(a,n,sizeof(int),compare);
for(int j=0;j<n;j++){
earn+=a[j];
if(earn>=spend){
printf("%d",j+1);
flag=1;
break;
}
}

if(flag==0){
printf("Game Over!");
}
return 0;


}

int compare (const void * a, const void * b)
{
return (-( (int)a - (int)b ));
}