-
Notifications
You must be signed in to change notification settings - Fork 0
/
Codeforces Round #118 (Div. 2), problem: (B) Growing Mushrooms
66 lines (60 loc) · 2.22 KB
/
Codeforces Round #118 (Div. 2), problem: (B) Growing Mushrooms
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
*/
#define pb push_back
#define pii pair<int,int>
#define pli pair<long long int,int>
#define pbi pair<bool,int>
#define pob pop_back
#define all(a) a.begin(),a.end()
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define i64 long long int
#define mem(x,y) memset(x,y,sizeof(x))
#define fill(arr,b) fill(arr, arr+sizeof(arr)/sizeof(arr[0]), b)
#define maxarr(n,arr,m) m=-1e9;for(int i=0;i<n;i++)if(arr[i]>m) m=arr[i];
#define read freopen("input.txt","r",stdin);
#define sortd(x,y) sort(x,y,greater<int>());
#define F first
#define S second
#define pdi pair<double,int>
const int maxn = (i64)1e9+7;
const double pi = acos(-1.0);
//bool fne(const pii &a, const pii &b){return (a.F > b.F)||(a.F==b.F&&a.S>b.S);}
//bool sne(const pii &a, const pii &b){return (a.S < b.S)||(a.S==b.S&&a.F<b.F);}
//bool isprime(int n){for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}
pair<double,int> arr[1005];
bool fne(const pair<double,int> &a, const pair<double,int> &b){
return (a.F > b.F)||(a.F==b.F&&a.S<b.S);
}
int main(){
//read;
fio;
int n;
double t1,t2,per;
cin>>n>>t1>>t2>>per;
double a,b;
for(int i=0;i<n;i++){
cin>>a>>b;
//if(a>b)swap(a,b);
double height1=a*t1;
height1-=((height1*per)/100.0);
height1+=(b*t2);
double height2=b*t1;
height2-=((height2*per)/100.0);
height2+=(a*t2);
arr[i]={max(height1,height2),i+1};
}
sort(arr,arr+n,fne);
for(int i=0;i<n;i++){
cout<<fixed<<setprecision(2)<<arr[i].S<<" ";
cout<<arr[i].F<<endl;
}
return 0;
}