-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path14908.cpp
More file actions
33 lines (25 loc) · 726 Bytes
/
14908.cpp
File metadata and controls
33 lines (25 loc) · 726 Bytes
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
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
#define MAXN 1050
int n;
double Ti[MAXN], Si[MAXN];
vector<pair<double,int>> gasungbi;
bool compare(pair<double,int> a, pair<double,int> b){
if(a.first == b.first) return a.second > b.second;
else return a.first < b.first;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin >> n;
for(int i=0 ; i<n ; i++){
cin >> Ti[i] >> Si[i];
gasungbi.push_back({Si[i]/Ti[i], i+1});
}
sort(gasungbi.begin(), gasungbi.end(), compare);
reverse(gasungbi.begin(), gasungbi.end());
for(int i=0 ; i<gasungbi.size() ; i++) cout << gasungbi[i].second << " ";
}