Educational Codeforces Round 112 (Rated for Div. 2)


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

Examples
Input
6
12
15
300
1
9999999999999999
3
Output
30
40
750
15
25000000000000000
15
----------------------------------------------------------------------------------------------------
B. Two Tables
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
8 5
2 1 7 4
4 2
5 4
2 2 5 4
3 3
1 8
0 3 1 6
1 5
8 1
3 0 6 1
5 1
8 10
4 5 7 8
8 5
Output
1.000000000
-1
2.000000000
2.000000000
0.000000000
----------------------------------------------------------------------------------------------------
C. Coin Rows
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3
1 3 7
3 5 1
3
1 3 9
3 5 1
1
4
7
Output
7
8
0
----------------------------------------------------------------------------------------------------
D. Say No to Palindromes
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 4
baacb
1 3
1 5
4 5
2 3
Output
1
2
0
1
----------------------------------------------------------------------------------------------------
E. Boring Segments
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 12
1 5 5
3 4 10
4 10 6
11 12 5
10 12 3
Output
3
Input
1 10
1 10 23
Output
0
----------------------------------------------------------------------------------------------------
F. Good Graph
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9 12
6 1 0
1 3 1
3 6 0
6 2 0
6 4 1
3 4 1
2 4 0
2 5 0
4 5 0
7 8 1
8 9 1
9 7 0
Output
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
----------------------------------------------------------------------------------------------------
