#include #include struct Heap{ double value; int index; Heap *left, *right; }; Heap* meld(Heap* a, Heap* b){ if(a == nullptr){return b;} if(b == nullptr){return a;} if(a->value < b->value){std::swap(a, b);} a->right = meld(a->right, b); std::swap(a->left, a->right); return a; } double ls[100000], maxLength[500001]; int ts[100000]; int main(){ int N; scanf("%d", &N); std::fill(ts, ts+N, 1); Heap *h = nullptr; for(int i=0;ivalue; int index = max_e->index; ts[index] += 1; Heap *new_e = new Heap{ls[index]/ts[index], index, nullptr, nullptr}; h = meld(new_e, meld(max_e->left, max_e->right)); } int Q; scanf("%d", &Q); for(int i=0;i