Codeforces Round 818 (Div. 2)


A. Madoka and Strange Thoughts
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
1
2
3
4
5
100000000
Output
1
4
7
10
11
266666666
----------------------------------------------------------------------------------------------------
B. Madoka and Underground Competitions
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 3 3 2
2 1 1 2
6 3 4 2
Output
X..
..X
.X.
XX
XX
.X..X.
X..X..
..X..X
.X..X.
X..X..
..X..X
----------------------------------------------------------------------------------------------------
C. Madoka and Formal Statement
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3
1 2 5
1 2 5
2
2 2
1 3
4
3 4 1 2
6 4 2 5
3
2 4 1
4 5 3
5
1 2 3 4 5
6 5 6 7 6
Output
YES
NO
NO
NO
YES
----------------------------------------------------------------------------------------------------
D. Madoka and The Corruption Scheme
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1
Output
2
Input
2 1
Output
3
Input
3 2
Output
7
----------------------------------------------------------------------------------------------------
E. Madoka and The Best University
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
Output
1
Input
5
Output
11
Input
69228
Output
778304278
----------------------------------------------------------------------------------------------------
F. Madoka and The First Session
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 5
1 1 1 1 1
-2 0 2 1 -1
1 5
1 4
3 5
3 4
4 5
Output
YES
1 5
1 4
5 3
4 3
5 4
Input
5 5
0 1 0 1 0
0 1 0 0 0
1 3
2 3
3 5
3 4
4 5
Output
YES
3 1
3 2
5 3
3 4
4 5
Input
4 4
1 1 1 1
0 2 -2 2
1 3
1 4
2 3
2 4
Output
NO
----------------------------------------------------------------------------------------------------
