Codeforces Beta Round 65 (Div. 2)


A. Way Too Long Words
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
word
localization
internationalization
pneumonoultramicroscopicsilicovolcanoconiosis
Output
word
l10n
i18n
p43s
----------------------------------------------------------------------------------------------------
B. Progress Bar
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10 10 54
Output
10 10 10 10 10 4 0 0 0 0 
Input
11 13 37
Output
13 13 13 13 0 0 0 0 0 0 0 
----------------------------------------------------------------------------------------------------
C. Round Table Knights
time limit per test: 0.5 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 1 1
Output
YES
Input
6
1 0 1 1 1 0
Output
YES
Input
6
1 0 0 1 0 1
Output
NO
----------------------------------------------------------------------------------------------------
D. Solitaire
time limit per test: 1.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 6
2S 3S 4S 7S 8S AS
5H 6H 7H 5S TC AC
8H 9H TH 7C 8C 9C
2D 2C 3C 4C 5C 6C
Output
No solution.
Input
4 6
2S 3S 4S 7S 8S AS
5H 6H 7H J1 TC AC
8H 9H TH 7C 8C 9C
2D 2C 3C 4C 5C 6C
Output
Solution exists.
Replace J1 with 2H.
Put the first square to (1, 1).
Put the second square to (2, 4).
Input
4 6
2S 3S 4S 7S 8S AS
5H 6H 7H QC TC AC
8H 9H TH 7C 8C 9C
2D 2C 3C 4C 5C 6C
Output
Solution exists.
There are no jokers.
Put the first square to (1, 1).
Put the second square to (2, 4).
----------------------------------------------------------------------------------------------------
E. Nuclear Fusion
time limit per test: 1.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10 3
Mn Co Li Mg C P F Zn Sc K
Sn Pt Y
Output
YES
Mn+C+K->Sn
Co+Zn+Sc->Pt
Li+Mg+P+F->Y
Input
2 1
H H
He
Output
YES
H+H->He
Input
2 2
Bk Fm
Cf Es
Output
NO
----------------------------------------------------------------------------------------------------
