General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
128546861 Practice:
Amul02Agrawal
1530C - 12 GNU C++17 Wrong answer on test 2 30 ms 3648 KB 2021-09-12 06:26:19 2021-09-12 06:26:19
 
 
→ Source
#include<bits/stdc++.h>
using namespace std;
#define ll                 long long int
#define ed                 "\n"
#define pb              push_back
#define sz(x)           (ll)((x).size())
#define all(x)          (x).begin(),(x).end()
#define pp                 pop_back
#define ff                 first
#define ss                 second
#define mp                 make_pair
#define rep(i,a,b)      for(int i=a;i<b;i++)
ll M = 1e9+1;
ll MM = 998244353;

template <typename... T>void read(T &...args) {((cin >> args), ...);}
template <typename... T>void write(string delimiter, T &&...args) {((cout << args << delimiter), ...);}

/*-------------------------------------------------------------------------------------------------------------------------------*/
ll gcd(ll a, ll b) {if (b > a) {return gcd(b, a);} if (b == 0) {return a;} return gcd(b, a % b);}
void swap(ll &x, ll &y) {ll temp = x; x = y; y = temp;}
bool revsort(ll a, ll b) {return a > b;}
void google(ll t) {cout << "Case #" << t << ": ";}
void precision(ll a) {cout << setprecision(a) << fixed;}
ll expo(ll a, ll b, ll mod) {ll res = 1; while (b > 0) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b = b >> 1;} return res;}
ll mod_add(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a + b) % m)) % m;}
ll mod_mul(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a * b) % m)) % m;}
ll mod_sub(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a - b) % m) + m) % m;}
/*-------------------------------------------------------------------------------------------------------------------------------*/


void solve()
{
    ll n; read(n); ll a[n],b[n];
    rep(i, 0, n)
    {
        cin>>a[i];
    }   
    rep(i, 0, n)
    {
        cin>>b[i];
    }
    sort(a, a+n, revsort);
    sort(b, b + n, revsort);
    ll k = n - (n/4);
    ll aSum = 0, bSum = 0;
    rep(i, 0, k)
    {
        aSum += a[i]; bSum += b[i];
    }
    if(aSum >= bSum) { cout<<0<<ed; return;}        
    ll ctn = 0;
    ll stage = k; 
    while(aSum < bSum)
    {
        aSum += 100;
        if(stage <= n-1)
        {
            bSum += b[stage];
            stage++;
        }
        ctn++;
    }
    cout<<ctn<<ed;
}
int main()
{
    
    int t = 1;
    cin>>t;
    for(ll i = 1; i<=t; i++)
    {    
        solve();
    }

}
 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details