|
|
вернуться в форумWA on test 2 Can anybody help me with test 2? What is it? I use merge sort. Re: WA on test 2 I use qsort and have the same situation. Re: WA on test 2 Послано Lomir 27 авг 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 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 Послано alext 3 сен 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 |
|
|