Advertisement
pdpd123

10026

Sep 8th, 2019
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include<iostream>
  2. #include<utility>
  3. #include<bits/stdc++.h>
  4. using namespace std;
  5.  
  6. pair<double,int> a[100000];
  7. int main(){
  8.     int T,count=1;
  9.     cin>>T;
  10.     while(count<=T){
  11.         int N;
  12.         double Z,B;
  13.         cin>>N;
  14.         for(int i=0;i<=N-1;i++){
  15.             cin>>Z>>B;
  16.             a[i].first=Z/B;
  17.             a[i].second=i+1;
  18.         }
  19.         stable_sort(a,a+N);
  20.         for(int j=0;j<=N-1;j++){
  21.             cout<<a[j].second<<" \n"[j==N-1];
  22.         }
  23.         if(count++ != T) cout<<endl;
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement