Wrong Answer in Dividing Array

Question is

You are given an array, A, of n elements. You have to remove exactly n/2 elements from array A, and add it to another array B(initially empty). After these operations, you can rearrange the elements of both the arrays in any order. We define, difference between these two arrays as :

∑ i = 1 N / 2 a b s ( A i − B i )
Find the maximum and minimum values of differences of these two arrays.

The two test cases :
1
10
746113975
-349360348
729136705
644545866
906164083
973748660
-216604078
-646300889
-377059304
-351182282

and

1
4
12 -3 10 0

Are returning expected answers, but the IDE responds Wrong Answer on submission.

Code Link: https://ide.codingblocks.com/s/67593

Harshita Bro,
For every test case you need to print answers in new line. you forgot to use endl.

Test case
2
4
1 2 3 4
4
1 2 3 4

Your output
2 4 2 4
Correct output
2 4
2 4

Hit like if u get it :slight_smile:

1 Like

Ohh God!!! that was it :disappointed:
Thank You Sir!!!:blush: