Codeforces Round 107 (Div. 1)


A. Win or Freeze
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
Output
2
Input
30
Output
1
6
Input
1
Output
1
0
----------------------------------------------------------------------------------------------------
B. Quantity of Strings
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1 1
Output
1
Input
5 2 4
Output
2
----------------------------------------------------------------------------------------------------
C. Smart Cheater
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3 10
0 10 100
100 0
1 2
2 3
1 3
Output
90.000000000
Input
10 8 187
0 10 30 70 150 310 630 1270 2550 51100
13 87 65 0 100 44 67 3 4
1 10
2 9
3 8
1 5
6 10
2 7
4 10
4 5
Output
76859.990000000
----------------------------------------------------------------------------------------------------
D. Mission Impassable
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
-1 -1 -1 -1 -1 -1 -1
abacaba
Output
0
Input
7
1 -1 -1 -1 -1 -1 -1
abacaba
Output
7
Input
7
1 5 -1 -1 -1 -1 10
abacaba
Output
16
----------------------------------------------------------------------------------------------------
E. Freezing with Style
time limit per test: 7 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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