codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#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; }
Private
[
?
]
Run code
Submit