Educational Codeforces Round 154 (Rated for Div. 2)


A. Prime Deletion
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4
123456789
987654321
243567918
576318429
Output
167
53
3571
57638429
----------------------------------------------------------------------------------------------------
B. Two Binary Strings
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
01010001
01110101
01001
01001
000101
010111
00001
01111
011
001
001001
011011
010001
011011
Output
YES
YES
YES
NO
NO
NO
YES
----------------------------------------------------------------------------------------------------
C. Queries for the Array
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
++1
+++1--0
+0
0
++0-+1-+0
++0+-1+-0
+1-+0
Output
YES
NO
NO
NO
YES
NO
NO
----------------------------------------------------------------------------------------------------
D. Sorting By Multiplication
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
5
1 1 2 2 2
6
5 4 3 2 5 1
3
1 2 3
Output
3
2
0
----------------------------------------------------------------------------------------------------
E. Non-Intersecting Subpermutations
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
10 3
Output
71712
Input
2 2
Output
2
Input
1337 42
Output
524933698
----------------------------------------------------------------------------------------------------
F. Four Suits
time limit per test: 6 seconds
memory limit per test: 1024 megabytes
input: standard input
output: standard output

Examples
Input
2
3 1 1 1
1 1 1 1
2 2 0 0
Output
1 0 
Input
4
0 0 0 0
0 0 0 1
2 2 0 0
0 1 0 0
3 2 3 2
Output
1 1 1 1 
Input
7
2 1 0 1
0 0 2 1
4 4 1 2
0 0 1 0
1 1 0 1
0 2 1 1
0 2 0 0
15 10 10 14
Output
5 6 1 7 5 5 7 
----------------------------------------------------------------------------------------------------
