Another Mex
CodeChefOpen on judge ↗
You have a sequence of n elements 0 , 1 , ... n-2 , n-1 . A permutation of this sequence is called stunning if the sum of mex of all the subarrays of this permutation is maximum possible . Chefina likes stunning sequences . Since valentines is on its way chef wants to gift as many stunning permutations to chefina as possible . Help chef to find the maximum number of permutations he can gift t
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.
Sign in to chat with the tutor and save your progress.
Sign in to start