fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long lint;
  4.  
  5. struct v{
  6. double a, b;
  7. int idx;
  8. }a[10005];
  9.  
  10. int n;
  11.  
  12. bool cmp(v a, v b){
  13. return a.a * b.b > b.a * a.b;
  14. }
  15.  
  16. int main(){
  17. cin >> n;
  18. for(int i=1; i<=n; i++){
  19. scanf("%lf %lf",&a[i].a, &a[i].b);
  20. a[i].idx = i;
  21. }
  22. sort(a+1, a+n+1, cmp);
  23. for(int i=1; i<=n; i++) printf("%d\n", a[i].idx);
  24. }
  25.  
Success #stdin #stdout 0s 3664KB
stdin
Standard input is empty
stdout
Standard output is empty