Educational Codeforces Round 142 (Rated for Div. 2)


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

Examples
Input
3
4
1 2 1 2
3
2 4 2
5
1 2 3 4 5
Output
3
3
5
----------------------------------------------------------------------------------------------------
B. Stand-up Comedian
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
5 0 0 0
0 0 0 5
2 5 10 6
3 0 0 7
Output
5
1
15
7
----------------------------------------------------------------------------------------------------
C. Min Max Sort
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
5
1 5 4 2 3
3
1 2 3
4
2 1 4 3
6
5 2 4 1 6 3
Output
2
0
1
3
----------------------------------------------------------------------------------------------------
D. Fixed Prefix Permutations
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 4
2 4 1 3
1 2 4 3
2 1 3 4
2 2
1 2
2 1
8 10
3 4 9 6 10 2 7 8 1 5
3 9 1 8 5 7 4 10 2 6
3 10 1 7 5 9 6 4 2 8
1 2 3 4 8 6 10 7 9 5
1 2 3 4 10 6 8 5 7 9
9 6 1 2 10 4 7 8 3 5
7 9 3 2 5 6 4 8 1 10
9 4 3 7 5 6 1 10 8 2
Output
1 4 4 
2 2 
10 8 1 6 8 10 1 7 
----------------------------------------------------------------------------------------------------
E. Divisors and Table
time limit per test: 2.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 72 1
10 10 15
6 1 210
Output
6 2
10 0
8 5
----------------------------------------------------------------------------------------------------
F1. Graph Coloring (easy version)
time limit per test: 5.5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
Output
6
Input
4
Output
50
Input
100
Output
878752271
Input
1337
Output
520628749
----------------------------------------------------------------------------------------------------
F2. Graph Coloring (hard version)
time limit per test: 5.5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
Output
6
Input
4
Output
50
Input
100
Output
878752271
Input
1337
Output
520628749
Input
42013
Output
906821221
----------------------------------------------------------------------------------------------------
