Codeforces Testing Round 1


A. 123-sequence
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9
1 3 2 2 2 1 1 2 3
Output
5
----------------------------------------------------------------------------------------------------
B. Right Triangles
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
**
*.
Output
1
Input
3 4
*..*
.**.
*.**
Output
9
----------------------------------------------------------------------------------------------------
C. Circular RMQ
time limit per test: 1.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2 3 4
4
3 0
3 0 -1
0 1
2 1
Output
1
0
0
----------------------------------------------------------------------------------------------------
