[ create a new paste ] login | about

Link: http://codepad.org/AO61iXmA    [ raw code | fork ]

C++, pasted on Jul 28:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <cstdio>
#include <algorithm>
struct wr { // Wrestler
    int a,b,c;
    bool operator<(const wr& other) const { return a+b*other.a < other.a+a*other.b; }
} d[10010];
int n;

int main()
{
    scanf("%d",&n);
    for(int i=1; i<=n; ++i){
        int a,b;
        scanf("%d%d", &a, &b);
        d[i]={a,b,i};
    }
    std::sort(d+1,d+n+1);
    for(int i=n; 1<=i; --i)
        printf("%d\n", d[i].c);
    return 0;
}


Create a new paste based on this one


Comments: