Codeforces Round 614 (Div. 2)


A. ConneR and the A.R.C. Markland-N
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
5 2 3
1 2 3
4 3 3
4 1 2
10 2 6
1 2 3 4 5 7
2 1 1
2
100 76 8
76 75 36 67 41 74 10 77
Output
2
0
4
0
2
----------------------------------------------------------------------------------------------------
B. JOE is on TV!
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
Output
1.000000000000
Input
2
Output
1.500000000000
----------------------------------------------------------------------------------------------------
C. NEKO's Maze Game
time limit per test: 1.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 5
2 3
1 4
2 4
2 3
1 4
Output
Yes
No
No
No
Yes
----------------------------------------------------------------------------------------------------
D. Aroma's Search
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1 2 3 1 0
2 4 20
Output
3
Input
1 1 2 3 1 0
15 27 26
Output
2
Input
1 1 2 3 1 0
2 2 1
Output
0
----------------------------------------------------------------------------------------------------
E. Xenon's Attack on the Gangs
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
1 2
2 3
Output
3
Input
5
1 2
1 3
1 4
3 5
Output
10
----------------------------------------------------------------------------------------------------
F. Chaotic V.
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
2 1 4
Output
5
Input
4
3 1 4 4
Output
6
Input
4
3 1 4 1
Output
6
Input
5
3 1 4 1 5
Output
11
----------------------------------------------------------------------------------------------------
