I have a small problem with this task...
It looks quite easy -- you only have to find median and say how many numbers are medians....
Do you know any tricky inputs for this task ??
Because I have WA

Pls help...
Moderator: Board moderators
step 3 and step 4 counts the underlined elements in the following example:1) sort all inputs in array with shell sort
2) output the median (i.e. a[total/2])
3) while ( a[total/2] == a[total/2 - j] )
count++; j++
4) j=0;
while ( a[total/2+1] == a[total/2 + 1 + j] )
count++; j++
5) output count & ( a[total/2+1] - a[total/2] + 1 )
How can I improve efficiency?1 2 5 5 5 5 6 6 7 98 9999
I solved this problem 10057 & got AC just now. I also confused with those descriptions.r.z. wrote:can you explain me about the output
For each set of input there will be one line of output. That line will contain the minimum possible value for A. ----> I understand this one
but I'm a bit confused with these two
Next it will contain how many numbers are there in the input that satisfy the property of A (The summation of absolute deviation from A is minimum). And finally you have to print how many possible different integer values are there for A (these values need not be present in the input). These numbers will be separated by single space.
can someone make it clear to me?
Code: Select all
5
1
2
2
2
4
8
3
5
6
6
7
7
10
11
Code: Select all
2 3 1
6 4 2