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,p=1;cin>>n;
        double a[n],k=0,j=n;
        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-i))){
                cout<<a[i]<<" ";
                p++;
            }
            k-=a[i];
        }
        if(p==n)
            cout<<"-1";
        cout<<"\n";

    }
}
Copy
To-do List call911kid
GNU G++17
471 ms
3.9 MB
Wrong Answer