Source Code
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define skip continue
#define fi first
#define se second
void MOUST(){
    ios_base::sync_with_stdio(0);
           cin.tie(0);
}
int main(){
    MOUST();

    int q;cin>>q;
    while(q--){
        ll n;cin>>n;
        double a[n],k=0,j=n,p=0;
        for(int i=0;i<n;i++){
            cin>>a[i];
            k+=a[i];
        }
        for(int i=0;i<n;i++){
            if(a[i]>=ceil(k/(j-p))){
                cout<<a[i]<<" ";
            }
            else{
                p++;
                k-=a[i];
            }
        }
        if(p==n)
            cout<<"-1";
        cout<<"\n";

    }
}
Copy
To-do List call911kid
GNU G++17
309 ms
3.5 MB
Wrong Answer