#include #define pb push_back #define sz(x) (int)(x).size() #define f first #define s second #define ll long long using namespace std; const int N=2e5+5; map done; __float128 best=LLONG_MAX; pair kad; void calc(int x,int y,vector &h){ if(x<1||y<1)return; if(done[x])return; done[x]=1; ll ans=0; for(auto p:h){ ll tr=p/x; if(p%x)tr++; ans+=tr; } __float128 aa=(__float128)ans/y; if(aa h(n); sort(h.begin(),h.end()); for(int i=0;i=1&&y>=1&&xn)break; int x=min((ll)k-1,h[n-1-i]); calc(x,k-x,h); } for(int p=0;p<1000;p++){ int tr=rand()%n; int x=min((ll)k-1,h[tr]); int mv=rand()%1000; x+=mv-50; calc(x,k-x,h); } printf("%i %i\n",kad.f,kad.s); }