fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. bool sortbysecdesc(const pair<int,long double> &a,
  6. const pair<int,long double> &b)
  7. {
  8. return a.second>b.second;
  9. }
  10.  
  11. int main()
  12. {
  13. long double n , t1 , t2 , p , x , y , sum , q , w;
  14. cin>>n>>t1>>t2>>p ;
  15.  
  16. vector< pair <int , long double> >z;
  17.  
  18. for(int i = 1 ; i <= n ; ++i)
  19. {
  20. cin>>x>>y ;
  21. q = (y * t1) - ((y * t1) * (p / 100.00)) + (x / 1.00 * (t2/1.00));
  22. w = (x * t1) - ((x * t1) * (p / 100.00)) + (y / 1.00 * (t2 / 1.00));
  23. sum = max(q , w);
  24. z.push_back(make_pair(i , sum));
  25. }
  26. sort(z.begin(), z.end(), sortbysecdesc);
  27. for(int i = 0 ; i < n ; ++i)
  28. {
  29. cout<<z[i].first<<" ";
  30. cout<<fixed<<setprecision(2)<<z[i].second<<endl;
  31. }
  32. return 0 ;
  33. }
  34.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty