Codeforces Round 410 (Div. 2)


A. Mike and palindrome
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
abccaa
Output
YES
Input
abbcca
Output
NO
Input
abcda
Output
YES
----------------------------------------------------------------------------------------------------
B. Mike and strings
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
xzzwo
zwoxz
zzwox
xzzwo
Output
5
Input
2
molzv
lzvmo
Output
2
Input
3
kc
kc
kc
Output
0
Input
3
aa
aa
ab
Output
-1
----------------------------------------------------------------------------------------------------
C. Mike and gcd problem
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 1
Output
YES
1
Input
3
6 2 4
Output
YES
0
Input
2
1 3
Output
YES
1
----------------------------------------------------------------------------------------------------
D. Mike and distribution
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
8 7 4 8 3
4 2 5 3 7
Output
3
1 4 5
----------------------------------------------------------------------------------------------------
E. Mike and code of a permutation
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

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