#CCBCHBAHAI0000118. Array Mastery II - Source & Semantics Clinic
Array Mastery II - Source & Semantics Clinic
Array Mastery II - Source & Semantics Clinic
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
Given and , perform a final chapter clinic: report inferred size and last valid index; copy independently; report UNKNOWN for attempting to recover original length from a function parameter int a[] via sizeof; find first/last index and frequency of ; reverse-copy the array; replace all by and count activated replacements; finally compute the minimum number of +1 moves needed to make the replaced array nondecreasing.
Input
Read , the array, then .
Output
Print the 9 lines specified by the Vietnamese statement: size/last index, copy, UNKNOWN, first/last, frequency, reverse, replacement count, replaced array, and minimum repair moves.
Subtask
Subtask 1 (20 points): , magnitudes at most 100.
Subtask 2 (30 points): , magnitudes at most .
Subtask 3 (50 points): , magnitudes at most .
Example
Input
5
3 1 3 2 3
3 4
Output
5 4
3 1 3 2 3
UNKNOWN
0 4
3
3 2 3 1 3
3
4 1 4 2 4
5
Explanation
After replacing 3 by 4, the array is (4,1,4,2,4); 3+2=5 increments are necessary.