Codeforces Global Round 20


A. Log Chopping
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
4
2 4 2 1
1
1
Output
errorgorn
maomao90
----------------------------------------------------------------------------------------------------
B. I love AAAB
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
AABAB
ABB
AAAAAAAAB
A
Output
YES
NO
YES
NO
----------------------------------------------------------------------------------------------------
C. Unequal Array
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
5
1 1 1 1 1
5
2 1 1 1 2
6
1 1 2 3 3 4
6
1 2 1 4 5 4
Output
2
1
2
0
----------------------------------------------------------------------------------------------------
D. Cyclic Rotation
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
5
1 2 3 3 2
1 3 3 2 2
5
1 2 4 2 1
4 2 2 1 1
5
2 4 5 5 2
2 2 4 5 5
3
1 2 3
1 2 3
3
1 1 2
2 1 1
Output
YES
YES
NO
YES
NO
----------------------------------------------------------------------------------------------------
E. notepad.exe
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
0
4
2
Output
? 1
? 9
? 16
! 32
----------------------------------------------------------------------------------------------------
F1. Array Shuffling
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
2
2 1
4
1 2 3 3
Output
1 2
3 3 2 1
----------------------------------------------------------------------------------------------------
F2. Checker for Array Shuffling
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2
2 1
1 2
4
1 2 3 3
3 3 2 1
2
2 1
2 1
4
1 2 3 3
3 2 3 1
Output
AC
AC
WA
WA
----------------------------------------------------------------------------------------------------
G. Cross Xor
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
?10
1??
010
Output
1
Input
2 3
000
001
Output
0
Input
1 1
?
Output
2
Input
6 9
1101011?0
001101?00
101000110
001011010
0101?01??
00?1000?0
Output
8
----------------------------------------------------------------------------------------------------
H. Zigu Zagu
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 3
11011
2 4
1 5
3 5
Output
1
3
2
Input
10 3
1001110110
1 10
2 5
5 10
Output
4
2
3
----------------------------------------------------------------------------------------------------
I. PermutationForces
time limit per test: 5 seconds
memory limit per test: 1024 megabytes
input: standard input
output: standard output

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