Educational Codeforces Round 62 (Rated for Div. 2)


A. Detective Book
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9
1 3 3 6 7 6 8 8 9
Output
4
----------------------------------------------------------------------------------------------------
B. Good String
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2
<>
3
><<
1
>
Output
1
0
0
----------------------------------------------------------------------------------------------------
C. Playlist
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
4 7
15 1
3 6
6 8
Output
78
Input
5 3
12 31
112 4
100 100
13 55
55 50
Output
10000
----------------------------------------------------------------------------------------------------
D. Minimum Triangulation
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
Output
6
Input
4
Output
18
----------------------------------------------------------------------------------------------------
E. Palindrome-less Arrays
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 3
-1 -1
Output
9
Input
5 2
1 -1 -1 1 2
Output
0
Input
5 3
1 -1 -1 1 2
Output
2
Input
4 200000
-1 -1 12345 -1
Output
735945883
----------------------------------------------------------------------------------------------------
F. Extending Set of Points
time limit per test: 3.5 seconds
memory limit per test: 1024 megabytes
input: standard input
output: standard output

Examples
Input
7
1 1
1 2
2 1
2 2
1 2
1 3
2 1
Output
1 2 4 4 4 6 3 
----------------------------------------------------------------------------------------------------
G. Double Tree
time limit per test: 10 seconds
memory limit per test: 1024 megabytes
input: standard input
output: standard output

Examples
Input
5
3 6 15 4 8
1 2 5 4
2 3 5 7
1 4 1 5
1 5 2 1
3
1 2
5 6
1 10
Output
3
15
4
----------------------------------------------------------------------------------------------------
