Codeforces Round 412 (rated, Div. 2, base on VK Cup 2017 Round 3)


A. Is it rated?
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
3060 3060
2194 2194
2876 2903
2624 2624
3007 2991
2884 2884
Output
rated
Input
4
1500 1500
1300 1300
1200 1200
1400 1400
Output
unrated
Input
5
3123 3123
2777 2777
2246 2246
2246 2246
1699 1699
Output
maybe
----------------------------------------------------------------------------------------------------
B. T-Shirt Hunt
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
239 10880 9889
Output
0
Input
26 7258 6123
Output
2
Input
493 8000 8000
Output
24
Input
101 6800 6500
Output
0
Input
329 19913 19900
Output
8
----------------------------------------------------------------------------------------------------
C. Success Rate
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3 10 1 2
7 14 3 8
20 70 2 7
5 6 1 1
Output
4
10
0
-1
----------------------------------------------------------------------------------------------------
D. Dynamic Problem Scoring
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
5 15 40 70 115
50 45 40 30 15
Output
2
Input
3
55 80 10 -1 -1
15 -1 79 60 -1
42 -1 13 -1 -1
Output
3
Input
5
119 119 119 119 119
0 0 0 0 -1
20 65 12 73 77
78 112 22 23 11
1 78 60 111 62
Output
27
Input
4
-1 20 40 77 119
30 10 73 50 107
21 29 -1 64 98
117 65 -1 -1 -1
Output
-1
----------------------------------------------------------------------------------------------------
E. Prairie Partition
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
1 1 2 2 3 4 5 8
Output
2 
Input
6
1 1 1 2 2 2
Output
2 3 
Input
5
1 2 4 4 4
Output
-1
----------------------------------------------------------------------------------------------------
F. Perishable Roads
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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