///kk to be reduced #include #define endl '\n' #define f first #define s second using namespace std; typedef long long ll; int n,k,nn; int pos; bool gfl; int speeds; int actual[100006]; int query[100006],tekcnt; set > x,y; pair positions[100006],initial[100006]; vector > tek; pair computers[100006]; double bestscore=DBL_MAX,score; pair raz[100006],speed[100006]; bool fl=0; int uk=1,cnt; int nachalni[100006]; int runners[100006],ans[100006]; int i,j,p,q,m; ifstream fin("runners.in"); ofstream fout("runners.out"); clock_t T; void input() { cin>>n>>k; nn=n; for(i=0; i>speed[i].f; for(i=1; i<=n; i++) cin>>computers[i].first>>computers[i].second; sort(speed,speed+k); } void finput() { ios_base::sync_with_stdio(false); fin.tie(NULL); fout.tie(NULL); fin>>n>>k; nn=n; for(i=0; i>speed[i].f; for(i=1; i<=n; i++) fin>>computers[i].first>>computers[i].second; sort(speed,speed+k); } void gen_perm() { T=clock(); if(cnt==1) { if(T>2500) { gfl=1; return ; } } pos++; cnt++; if(k>10000 && cnt==1) pos=k/2; else if(k>10000) pos=0; if(pos==k) { ///ne e zaduljitelno, moje da drupnem n edna poziciq nazad nn/=2; if(nn<2*k || k==1) { gfl=1; return; } pos=1; } // cout< a,pair b) { double st = sqrt((long long)((a.f-b.f)*1ll*(a.f-b.f))+(long long)((a.s-b.s)*1ll*(a.s-b.s))); return st; } void foutput() { //cout<4700) { gfl=1; return ; } // cout<4300) Rbound=min(Rbound,10); mn = DBL_MAX; for(j=0;j<=Rbound;j++) { double dist = calcc(tek[j],computers[i])*speed[j].first; // cout<score) { bestscore=score; // cout<=4700) { gfl=1; return ; } int br=0; ///za x tekcnt++; auto pos=x.lower_bound({computers[i].f,1}); int lst=0; int obshto=70; if(k>=10000)obshto=100; if(cnt==1 && T>3500) obshto=50; for(auto it=pos; it!=x.end() && br1000) solve(); else solve_smaller(); //output(); foutput(); return 0; } /** 10 1 1.5 1 10 2 9 23 17 5 6 9 12 170 83 247 23 3 4 7 2 9 1 5 1 1.300000 3 8 6 7 9 4 10 2 1 5 5 2 1.3 1.8 3 8 6 7 9 4 10 2 1 5 */