#include <bits/stdc++.h>
using namespace std;
double s[100005];
struct shu{
struct node{
double *a;
node *l,*r;
}*head;
node* build(int l,int r){
if(l > r) return NULL;
int mid = (l + r) >> 1;
node* tmp = new node;
tmp -> a = new double(s[mid]);
if(l == r) return tmp;
tmp -> l = build(l,mid - 1);
tmp -> r = build(mid + 1,r);
return tmp;
}
void dfs(node* x){
if((x -> l) != NULL) dfs(x -> l);
cout << *(x -> a) << ' ';
if((x -> r) != NULL) dfs(x -> r);
}
}t;
int n,m,h;
int main(){
scanf("%d%d",&n,&h);
int x,y,z;
for(int i = 1;i <= n;i++){
scanf("%d%d",&x,&y);
s[i] = 1.0 * x / y;
}
sort(s + 1,s + 1 + n);
t.head = t.build(1,n);
t.dfs(t.head);
return 0;
}
蒟蒻指针写挂了,望大佬救命QWQ