Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // https://uva.onlinejudge.org/external/100/p10026.pdf
- #include <bits/stdc++.h>
- using namespace std;
- bool func(pair<int,int> a, pair<int,int> b)
- {
- return a.first < b.first;
- }
- int main()
- {
- int n;scanf("%d",&n);
- while(n--)
- {
- int s;scanf("%d",&s);
- vector<pair<double,int> > v;
- for(int i = 0; i < s;i++)
- {
- double a,b;
- scanf("%lf %lf",&a,&b);
- pair<double,int> aux;
- aux.first = b*a;
- aux.second = i+1;
- v.push_back(aux);
- }
- //stable_sort(v.begin(),v.end(),func);
- stable_sort(v.begin(),v.end(),func);
- for(int i = 0; i < v.size();i++)
- {
- if(i == v.size()-1)
- cout << v[i].second << endl;
- else
- cout << v[i].second << " ";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement