Codeforces Round 705 (Div. 2)


A. Anti-knapsack
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 2
5 3
1 1
Output
2
3 1 
3
4 5 2 
0
----------------------------------------------------------------------------------------------------
B. Planet Lapituletti
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
24 60
12:21
24 60
23:59
90 80
52:26
1 100
00:01
10 10
04:04
Output
12:21
00:00
52:28
00:00
00:00
----------------------------------------------------------------------------------------------------
C. K-beautiful Strings
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4 2
abcd
3 1
abc
4 3
aaaa
9 3
abaabaaaa
Output
acac
abc
-1
abaabaaab
----------------------------------------------------------------------------------------------------
D. GCD of an Array
time limit per test: 2.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
1 6 8 12
1 12
2 3
3 3
Output
2
2
6
----------------------------------------------------------------------------------------------------
E. Enormous XOR
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
0010011
1111010
Output
1111111
Input
4
1010
1101
Output
1101
----------------------------------------------------------------------------------------------------
F. Enchanted Matrix
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 4
1
1
1
0
Output
? 1 2 1 1 1 3
? 1 2 2 1 2 3
? 1 2 3 1 3 3
? 1 1 1 1 1 2
! 2
----------------------------------------------------------------------------------------------------
