Codeforces Round 136 (Div. 1)


A. Little Elephant and Problem
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 2
Output
YES
Input
3
3 2 1
Output
YES
Input
4
4 3 2 1
Output
NO
----------------------------------------------------------------------------------------------------
B. Little Elephant and Array
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 2
3 1 2 2 3 3 7
1 7
3 4
Output
3
1
----------------------------------------------------------------------------------------------------
C. Little Elephant and Shifts
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 2
2 1
Output
1
0
Input
4
2 1 3 4
3 4 2 1
Output
2
1
0
1
----------------------------------------------------------------------------------------------------
D. Little Elephant and Triangle
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 1
Output
36
Input
2 2
Output
240
----------------------------------------------------------------------------------------------------
E. Little Elephant and Inversions
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 1
1 3 2
Output
3
Input
5 2
1 3 2 1 7
Output
6
----------------------------------------------------------------------------------------------------
