asim2005's blog

By asim2005, 5 months ago, In English

https://codeforces.com/problemset/problem/1405/A

In this problem, I couldn't understand the "adjacent" thing. Can anybody please help me ? Thanks in advance.

 
 
 
 
  • Vote: I like it
  • -3
  • Vote: I do not like it

»
5 months ago, # |
  Vote: I like it 0 Vote: I do not like it

We need to take two consecutive input integer sum, and sort them like... Example Input 2: 2 1 6 5 4 3

Now, the sorted sum will be like:

sort([ 2+1, 1+6, 6+5, 5+4, 4+3]). sort(3, 7, 11, 9, 7)

This gives us the array [3,7,7,9,11].

But, we need to need another array also, i.e.; We need to change two consecutive integer places, so the input array now will be: 1 2 5 6 3 4

Now again take two consecutive integer sum as done above, so the new sorted sum will be like: sort([ 1 + 2, 2 + 5, 5 + 6, 6 + 3, 3 + 4 ]). sort(3, 7, 11, 9, 7)

This gives us the array [3,7,7,9,11].

And we need to output that array.