Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<utility>
- #include<bits/stdc++.h>
- using namespace std;
- pair<double,int> a[100000];
- int main(){
- int T,count=1;
- cin>>T;
- while(count<=T){
- int N;
- double Z,B;
- cin>>N;
- for(int i=0;i<=N-1;i++){
- cin>>Z>>B;
- a[i].first=Z/B;
- a[i].second=i+1;
- }
- stable_sort(a,a+N);
- for(int j=0;j<=N-1;j++){
- cout<<a[j].second<<" \n"[j==N-1];
- }
- if(count++ != T) cout<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement