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

C++
Posted by Varun Sharma 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 !
Re: C++
Posted by Igor9669 19 Apr 2009 12:46
Try to think how to solve it without any sorting!!!
Re: C++
Posted by [MSU Detritus] freopen 30 Jul 2010 11:27
without ANY sorting? How do you sort array without any sorting?
Re: C++
Posted by Tvildiani Daviti[Tbilisi SU] 11 Aug 2011 21:31
It is not necessary to sort array :) Just read input + :)
Re: C++
Posted by kostan3 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;
}