MemSQL Start[c]UP 2.0 - Round 2 - Online Round


A. Golden System
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1000
111
Output
<
Input
00100
11
Output
=
Input
110
101
Output
>
----------------------------------------------------------------------------------------------------
B. Distributed Join
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
2 6
3 100
Output
11
Input
2 3
10 10
1 1 1
Output
6
----------------------------------------------------------------------------------------------------
C. Elections
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2
1 2
1 2
2 1
0 0
Output
3
Input
4
1 2
1 2
2 1
0 0
Output
2
Input
1
100000 0
Output
0
----------------------------------------------------------------------------------------------------
D. Bingo!
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 2 1
Output
2.5
Input
2 4 3
Output
4
Input
7 59164 40872
Output
3.1415926538
----------------------------------------------------------------------------------------------------
E. Flow Optimality
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 5
1 2 1 2
1 3 4 1
2 3 2 1
2 4 4 1
3 4 1 2
Output
6
Input
5 5
2 3 1 1
3 4 1 1
4 2 1 1
1 5 1 1
1 5 100 100
Output
BAD 3
Input
6 4
1 3 31 41
1 5 59 26
2 6 53 58
4 6 97 93
Output
UNKNOWN
Input
7 5
1 7 2 1
2 3 1 1
4 5 1 0
6 1 10 0
1 3 1 1
Output
BAD 4
----------------------------------------------------------------------------------------------------
F. An easy problem about trees
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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