← All problemsSign in

Sereja and Sorting 2

CodeChefRating 3649Open on judge ↗

Sereja has an array A[1 .. N], which contains N integers. Now Sereja wants to sort it. The only thing that Sereja can do, is to reverse all elements in some sub-array, which is a consecutive parts of A. In other words, in one operation, Sereja can choose two integers L and R (1 , and swap elements A[L] and A[R], A[L+1] and A[R-1], A[L+2] and A[R-2] and so on. In such operation of L, R, the tota

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start