11321 - Sort! Sort!! and Sort!!!

All about problems in Volume 113. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

mukit
New poster
Posts: 48
Joined: Wed Nov 21, 2007 10:09 am
Location: Dhaka , Bangladesh
Contact:

WA 11321 - Sort! Sort!! and Sort!!!

Post by mukit » Mon May 19, 2008 10:27 pm

Some one please where i did wrong ? I got lots of WA :evil:

Code: Select all

I found my problem . . .
Thank's in advance.
Last edited by mukit on Tue Jul 29, 2008 8:56 pm, edited 1 time in total.

lnr
Experienced poster
Posts: 142
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

Re: 11321 - Sort! Sort!! and Sort!!!

Post by lnr » Fri Jun 20, 2008 8:38 am

Removed
Last edited by lnr on Tue Jun 24, 2008 5:49 am, edited 1 time in total.

lnr
Experienced poster
Posts: 142
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

Re: 11321 - Sort! Sort!! and Sort!!!

Post by lnr » Fri Jun 20, 2008 8:46 am

Removed
Last edited by lnr on Tue Jun 24, 2008 5:49 am, edited 1 time in total.

Chirag Chheda
Learning poster
Posts: 74
Joined: Sat Jun 21, 2008 12:24 pm
Location: India

Why WA?????[:(]

Post by Chirag Chheda » Sat Jun 21, 2008 2:48 pm

Can neone plz tell me whr m i going wrong . i use sort function from STL...i cleared all the test cases given in the forum...
thnx in advance....

Code: Select all

Code Acc!!!         
Last edited by Chirag Chheda on Sun Jun 22, 2008 10:51 am, edited 1 time in total.

User avatar
emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

Re: 11321 - Sort! Sort!! and Sort!!!

Post by emotional blind » Sun Jun 22, 2008 8:59 am

Prolem is here

Code: Select all

            if(n1>n2)   
            return true;
           
            else
            return true;

Chirag Chheda
Learning poster
Posts: 74
Joined: Sat Jun 21, 2008 12:24 pm
Location: India

Re: 11321 - Sort! Sort!! and Sort!!!

Post by Chirag Chheda » Sun Jun 22, 2008 10:52 am

Thank you Sir!!!
finalyy i got ACC

lnr
Experienced poster
Posts: 142
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

11321 - Sort! Sort!! and Sort!!! Why WA

Post by lnr » Tue Jun 24, 2008 5:52 am

Thanks Jan.
Code Removed.
Last edited by lnr on Thu Jun 26, 2008 12:47 pm, edited 3 times in total.

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Re: 11321 - Sort! Sort!! and Sort!!!

Post by Jan » Wed Jun 25, 2008 10:38 pm

Try the cases.

Input:

Code: Select all

3 3
9
12
10

15 3
-1
-2
-3
-4
-5
6
7
8
9
-10
-11
-12
-13
14
15

0 0
Output:

Code: Select all

3 3
9
12
10
15 3
-5
-11
-2
-1
-13
-10
-4
15
9
-3
-12
6
7
8
14
0 0
Ami ekhono shopno dekhi...
HomePage

Chirag Chheda
Learning poster
Posts: 74
Joined: Sat Jun 21, 2008 12:24 pm
Location: India

Re: 11321 - Sort! Sort!! and Sort!!!

Post by Chirag Chheda » Thu Jun 26, 2008 7:41 am

Well the output to the second part in the above example is wrong.

I think -5 should come before -3 as -5%3=-2 & -3%3=0

My Acc prog gives the following output:
15 3
-5
-11
-2
-1
-13
-10
-4
15
9
-3
-12
6
7
8
14
0 0

lnr
Experienced poster
Posts: 142
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

11321 - Sort! Sort!! and Sort!!!

Post by lnr » Thu Jun 26, 2008 12:41 pm

It is confusing.
Jan's output and Cherag Chheda's output are different for the same input.
How is it possible?
Please explain.
Last edited by lnr on Thu Jun 26, 2008 12:57 pm, edited 1 time in total.

lnr
Experienced poster
Posts: 142
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

11321 - Sort! Sort!! and Sort!!!

Post by lnr » Thu Jun 26, 2008 12:48 pm

I think Jan's output is wrong.Isn't it?
It may be a copy pase mistake.

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Re: 11321 - Sort! Sort!! and Sort!!!

Post by Jan » Fri Jun 27, 2008 7:45 am

You are right. I have changed the output. I forgot to change from '%lld' to '%I64d'. Sorry about that.
Ami ekhono shopno dekhi...
HomePage

lnr
Experienced poster
Posts: 142
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

11321 - Sort! Sort!! and Sort!!! WA

Post by lnr » Fri Jun 27, 2008 8:12 am

Code Removed
Last edited by lnr on Fri Jun 27, 2008 4:07 pm, edited 1 time in total.

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Re: 11321 - Sort! Sort!! and Sort!!!

Post by Jan » Fri Jun 27, 2008 8:49 am

Try the case.

Input

Code: Select all

9 2
-15509
-13005
-4058
-11173
-10564
16391
-1396
-12098
-15847
0 0
Output:

Code: Select all

9 2
-11173
-13005
-15509
-15847
-12098
-10564
-4058
-1396
16391
0 0
Hope it helps.
Ami ekhono shopno dekhi...
HomePage

lnr
Experienced poster
Posts: 142
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

11321 - Sort! Sort!! and Sort!!!

Post by lnr » Mon Jun 30, 2008 3:17 pm

Removed.
Last edited by lnr on Tue Jul 01, 2008 2:28 pm, edited 3 times in total.

Post Reply

Return to “Volume 113 (11300-11399)”