Codeforces Round 761 (Div. 2)


A. Forbidden Subsequence
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
abacaba
abc
cccba
acb
dbsic
bac
abracadabra
abc
dddddddddddd
cba
bbc
abc
ac
abc
Output
aaaacbb
abccc
bcdis
aaaaacbbdrr
dddddddddddd
bbc
ac
----------------------------------------------------------------------------------------------------
B. GCD Problem
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
18
63
73
91
438
122690412
Output
6 9 3
21 39 3
29 43 1
49 35 7
146 219 73
28622 122661788 2
----------------------------------------------------------------------------------------------------
C. Paprika and Permutation
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2
1 7
3
1 5 4
4
12345678 87654321 20211218 23571113
9
1 2 3 4 18 19 5 6 7
Output
1
-1
4
2
----------------------------------------------------------------------------------------------------
D1. Too Many Impostors (easy version)
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
6
0
1
9
1
Output
? 1 2 3
? 3 4 5
! 3 4 1 2
? 7 1 9
! 4 2 3 6 8
----------------------------------------------------------------------------------------------------
D2. Too Many Impostors (hard version)
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
6
0
1
9
1
Output
? 1 2 3
? 3 4 5
! 3 4 1 2
? 7 1 9
! 4 2 3 6 8
----------------------------------------------------------------------------------------------------
E. Christmas Chocolates
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

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