Question: Problem C. Interesting lecture Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes Today Vasya visited a lecture



Problem C. Interesting lecture Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes Today Vasya visited a lecture on the topic of arrays. Lecture was really interesting, but given homework is also fascinating. Here it is: You are given an array of size n. Your task is to get a subarray of maximum possible length, where all elements are equal, using at most one reverse of some subarray. Vasya loved this task, but he is too busy tonight, so he asked you to help him. Just to remind, reverse of subarray from position 1 to position (inclusively) transforms an array of elements 21,...,01-1,2,. , Ar+1,...,an to an array of elements 01,...,01-1, Oy, Or-1,...,01+1, 01, Ar+1,...,an Input The first line contains one integer n (1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
