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 1322. Spy

wa#6...
Posted by visitor 16 Jan 2007 10:59
who can tell me what the test6 is? Thanks
Re: wa#6...
Posted by Mace(Lviv Polytechniс NU) 9 Jan 2008 02:03
If you are using sort in your algo and sorting pairs<char ch,int position>, you must compare this pairs by a "ch", but if "ch"`s are equal - you must compare "position". Comparsion function may be like that:

struct s{char c;int p;};

bool cmp(s a, s b)
{
    if(a.c!=b.c)
    {
        return a.c<b.c;
    }
    return a.p<b.p;
}
Re: wa#6...
Posted by vtalgo21_gsavon 19 Mar 2021 03:55
Use stable_sort instead of sort (if you're doing on C/C++)