C. Pride time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You have an array a with length n, you can perform operations. Each operation is like this: choose two adjacent elements from a, sa…