Codeforces Round 921 (Div. 1)


A. Did We Get Everything Covered?
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2 2 4
abba
2 2 3
abb
3 3 10
aabbccabab
Output
YES
NO
aa
NO
ccc
----------------------------------------------------------------------------------------------------
B. Space Harbour
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8 3 4
1 3 8
3 24 10
2 2 5
1 5 15
2 5 5
2 7 8
Output
171
0
15
----------------------------------------------------------------------------------------------------
C. Fractal Origami
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1
2
3
Output
0
1
714285638
----------------------------------------------------------------------------------------------------
D. Balanced Subsequences
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2 2 2
3 2 3
3 2 1
Output
2
0
4
----------------------------------------------------------------------------------------------------
E. Paper Cutting Again
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2 4 10
2 4 8
2 4 2
2 4 6
Output
0
1
833333342
250000003
----------------------------------------------------------------------------------------------------
F. Anti-Proxy Attendance
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
5
3
2
1
2
0
1
0
2
0
1
6
6
2
2
0
1
1
0
0
0
1
Output
? 1 4
? 3 5
? 2 2
? 1 3
? 3 3
? 3 3
! 3
? 2 4
? 4 4
! 2
#
? 1 6
? 1 3
? 4 6
? 1 1
? 3 3
? 5 5
! 3
? 2 2
? 4 4
! 4
#
----------------------------------------------------------------------------------------------------
