Educational Codeforces Round 92 (Rated for Div. 2)


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

Examples
Input
4
1 1337
13 69
2 4
88 89
Output
6 7
14 21
2 4
-1 -1
----------------------------------------------------------------------------------------------------
B. Array Walk
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
5 4 0
1 5 4 3 2
5 4 1
1 5 4 3 2
5 4 4
10 20 30 40 50
10 7 3
4 6 8 2 9 9 7 4 10 9
Output
15
19
150
56
----------------------------------------------------------------------------------------------------
C. Good String
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
95831
100120013
252525252525
Output
3
5
0
----------------------------------------------------------------------------------------------------
D. Segment Intersections
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 5
1 2
3 4
2 1000000000
1 1
999999999 999999999
10 3
5 10
7 8
Output
7
2000000000
0
----------------------------------------------------------------------------------------------------
E. Calendar Ambiguity
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
6 7 4
10 7 12
12 30 7
1 1 1
3247834 10298779 625324
Output
6
9
5
0
116461800
----------------------------------------------------------------------------------------------------
F. Bicolored Segments
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 3 1
4 6 2
2 5 1
Output
2
Input
5
5 8 1
1 3 2
3 4 2
6 6 1
2 10 2
Output
4
Input
7
19 20 1
13 15 2
6 11 2
4 10 1
14 17 1
13 13 2
5 9 1
Output
5
----------------------------------------------------------------------------------------------------
G. Directing Edges
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3 2 2
1 3
11 1 5
10 10
1 2
2 3
Output
11 2 5 
Input
4 4 4
1 2 3 4
1 5 7 8
100 100 100 100
1 2
2 3
3 4
1 4
Output
21 21 21 21 
----------------------------------------------------------------------------------------------------
