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

WA on test 2
Posted by Diduk Kirill 1 May 2007 14:46
Can anybody help me with test 2? What is it?
I use merge sort.
Re: WA on test 2
Posted by Bychkov=>[ProgMyaZzz] 27 Aug 2007 02:48
I use qsort and have the same situation.
Re: WA on test 2
Posted by Lomir 27 Aug 2007 06:21
You need to use stable sort.
Bubble sort is stable nad qsort isn't.

I used std::stable_sort() from C++ tempate library.
Here also can be used linear radix stable sort or counting sort.
Re: WA on test 2
Posted by Yvonne Young 29 Aug 2007 23:15
i use counting sort, and got AC in 0.187s.
=======core=======
  fillchar(c,sizeof(c),0);
  for i:=1 to n do inc(c[a[i].m]);
  for i:=99 downto 0 do inc(c[i],c[i+1]);
  for i:=n downto 1 do
    begin
      b[c[a[i].m]]:=a[i];
      dec(c[a[i].m])
    end;
==================
Re: WA on test 2
Posted by alext 3 Sep 2007 20:32
I used merge sort and I've got AC.

Use this test:
6
1 1
2 1
3 2
4 2
5 3
6 3

Right Answer is:
5 3
6 3
3 2
4 2
1 1
2 1