Why is my approach to Parity Shuffle Sorting wrong?

Правка en2, от RedBlackTrees, 2022-09-29 02:26:55

Hi! I was upsolving a question CodeForces Round Div2 #821 C. https://codeforces.com/problemset/problem/1733/C.

My approach is pretty simple. Just make all the elements of the array equal. To accomplish this...

1) The consecutive index sum is always odd as (even + odd = odd). So, just print out n-1 operations as we don't have to find the minimum and run the loop from the last index till the first index and make all the elements of the array equal to the last element.

So, for example for an array [4, 3, 2, 1], the answer from my approach should be:

3

(3, 4) (2, 3) (1, 2)

which will give you an array [1,1,1,1] which is non decreasing.

This is my submission https://codeforces.com/contest/1733/submission/173866286

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский RedBlackTrees 2022-09-29 02:26:55 11 Tiny change: 'be:\n\n3\n3 4\n2 3\n1 2\n\nwhich ' -> 'be:\n\n3\n\n(3, 4)\n(2, 3)\n(1, 2)\n\nwhich '
en1 Английский RedBlackTrees 2022-09-29 02:23:22 782 Initial revision (published)