#include using namespace std; #define REP(i,a,b) for(i=a;i'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);} template struct heapEx { int *hp, *place, size; T *val; void malloc(int N){hp=(int*)std::malloc(N*sizeof(int));place=(int*)std::malloc(N*sizeof(int));val=(T*)std::malloc(N*sizeof(T));} void free(){free(hp);free(place);free(val);} void* malloc(int N, void *workMemory){hp=(int*)workMemory;workMemory=(void*)(hp+N);place=(int*)workMemory;workMemory=(void*)(place+N);val=(T*)workMemory;workMemory=(void*)(val+N);return workMemory;} void init(int N){int i;size=0;rep(i,N)place[i]=-1;} void up(int n){int m;while(n){m=(n-1)/2;if(val[hp[m]]<=val[hp[n]])break;swap(hp[m],hp[n]);swap(place[hp[m]],place[hp[n]]);n=m;}} void down(int n){int m;for(;;){m=2*n+1;if(m>=size)break;if(m+1val[hp[m+1]])m++;if(val[hp[m]]>=val[hp[n]])break;swap(hp[m],hp[n]);swap(place[hp[m]],place[hp[n]]);n=m;}} void change(int n, T v){T f=val[n];val[n]=v;if(place[n]==-1){place[n] = size;hp[size++] = n;up(place[n]);}else{if(f < v) down(place[n]); else if(f > v) up(place[n]);}} int pop(void){int res=hp[0];place[res]=-1;size--;if(size)hp[0]=hp[size],place[hp[0]]=0,down(0);return res;} }; int N, Q; int A[200000], use[200000]; double res[500001]; int K[100000]; int main(){ int i, j, k; heapEx hp; reader(&N); rep(i,N) reader(A+i); reader(&Q); rep(i,Q) reader(K+i); assert(1 <= N && N <= 200000); rep(i,N) assert(1 <= A[i] && A[i] <= 1000000000); assert(1 <= Q && Q <= 100000); rep(i,Q) assert(1 <= K[i] && K[i] <= 500000); hp.malloc(N); hp.init(N); rep(i,N) hp.change(i, -A[i]), use[i] = 1; REP(i,1,500001){ k = hp.hp[0]; res[i] = -hp.val[k]; use[k]++; hp.change(k, -A[k]/(double)use[k]); } rep(i,Q) printf("%.9f\n",res[K[i]]); return 0; }