10057 - A mid-summer night's dream.
Moderator: Board moderators
can any body give the correct output for these inputs:
thanks in advance 
Code: Select all
2
1 1
4
1 1 1 2
5
2 2 2 2 6
9
1 2 5 5 5 6 6 7 8
16
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 65000
17
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 65000
16
1 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000
17
1 1 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000
10
1 2 3 4 5 6 7 8 9
21
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6

9th input has no 10 elements, so I added '10' in the tail.2
1 1
4
1 1 1 2
5
2 2 2 2 6
9
1 2 5 5 5 6 6 7 8
16
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 65000
17
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 65000
16
1 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000
17
1 1 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000 65000
10
1 2 3 4 5 6 7 8 9 10
21
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6
My code outputs :
Code: Select all
1 2 1
1 3 1
2 4 1
5 3 1
1 15 1
1 16 1
65000 15 1
65000 15 1
5 2 2
5 5 1
-
- Experienced poster
- Posts: 103
- Joined: Tue Mar 25, 2008 11:00 pm
- Location: IUT-OIC, DHAKA, BANGLADESH
- Contact:
10057 - A Mid-summer Night’s Dream WA
thanx "Bluefin". I got AC now.
actually I misunderstood the problem at somewhere.....I recoded and got AC.
actually I misunderstood the problem at somewhere.....I recoded and got AC.
Last edited by kbr_iut on Wed Sep 10, 2008 9:43 am, edited 1 time in total.
It is tough to become a good programmer.
It is more tough to become a good person.
I am trying both...............................
It is more tough to become a good person.
I am trying both...............................
Re: 10057 - A Mid-summer Night’s Dream
Hello, kbr_iut:
I solved this problem this morning. I think your program failed on the following case
your program prints
while my AC program returns
Hope this case will help you debug. 
I solved this problem this morning. I think your program failed on the following case
Code: Select all
7
1 2 2 3 4 5 7
Code: Select all
2 3 1
Code: Select all
3 1 1

Re:
mamun wrote:Problem descripiton was really confusing to me. Thanks to tan_Yui for explaining it. But I am still getting WA. Can somebody say if I am correct with my understanding?I'm passing all the samples posted here.
- 1st number to output is the median
2nd number to output is the frequency of median(s) in the input
3rd number to output is 1 if n is odd, median2 - median1 + 1 otherwise.
i think you are in wrong with 2nd output
for example out put for
6
1
2
2
4
4
5
is
2 4 3
the second output is number of A that there are in input
for previous example A can be 2 or 3 or 4
for first output minimum is 2
for second output there are two 2 and two 4 and zero 3 in the input then two + two + zero = 4
for the last output A can get 3 number(2,3,4) then output is 3
Re: 10057 - A Mid-summer Night’s Dream
Thanks to all for all the great test cases and discussions. This really helped out a bunch.