ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1100. Final Standings

Varun Sharma C++ [4] // Problem 1100. Final Standings 19 Apr 2009 09:20
Well, this one turned out to be easy. Luckily there is a function in the header algorithm (stable_sort) that sorts the objects on the basis of one of its contents ! and that's all was needed here !
Igor9669 Re: C++ [2] // Problem 1100. Final Standings 19 Apr 2009 12:46
Try to think how to solve it without any sorting!!!
[MSU Detritus] freopen Re: C++ [1] // Problem 1100. Final Standings 30 Jul 2010 11:27
without ANY sorting? How do you sort array without any sorting?
Tvildiani Daviti[Tbilisi SU] Re: C++ // Problem 1100. Final Standings 11 Aug 2011 21:31
It is not necessary to sort array :) Just read input + :)
kostan3 Re: C++ // Problem 1100. Final Standings 7 Jun 2012 23:34
#include <cstdio>
#include <algorithm>

using namespace std;

struct node {
    int id;
    int solve;
} a [10000000 + 10];

bool cmp (node p, node q)
{
    if ( p.solve > q.solve ) return true;
    return false;
}

int main ()
{
    int n; scanf ("%d", &n);

    for ( int i = 0; i < n; i++ ) scanf ("%d %d", &a [i].id, &a [i].solve);

    stable_sort (a, a + n, cmp);

    for ( int i = 0; i < n; i++ ) printf ("%d %d\n", a [i].id, a [i].solve);

    return 0;
}