struct C{ll i,j;}; ll a[1d5],b[1d5]; bool operator<(C x,C y){ ll d=a[x.i]*b[y.j]-a[y.i]*b[x.j]; return d<0?1:d>0?0:x.i>y.i; } { ll@n,@m; rd(a(n),b(m)); priority_queueq; rep(i,n)q.push({i,0}); rep(m){ C c=q.top(); q.pop(); wt(c.i+1); c.j++; q.push(c); } }