Codeforces Beta Round 96 (Div. 1)
E
Bits of merry old England
Codeforces
2700
原题
← D→
翻译中…

Another feature of Shakespeare language is that the variables are named after characters of plays by Shakespeare, and all operations on them (value assignment, output etc.) look like a dialog with other characters. New values of variables are defined in a rather lengthy way, so a programmer should try to minimize their usage.

翻译中…

You have to print the given sequence of $*n*$ integers. To do this, you have $*m*$ variables and two types of operations on them:

翻译中…
  • variable=integer
  • print(variable)
翻译中…

Any of the $*m*$ variables can be used as variable. Variables are denoted by lowercase letters between "a" and "z", inclusive. Any integer number can be used as integer.

翻译中…

Let's say that the penalty for using first type of operations equals to the number of set bits in the number integer. There is no penalty on using second type of operations. Find and output the program which minimizes the penalty for printing the given sequence of numbers.

翻译中…

Input

翻译中…

The first line of input contains integers $*n*$ and $*m*$ ($1 ≤ *n* ≤ 250$, $1 ≤ *m* ≤ 26$). The second line contains the sequence to be printed. Each element of the sequence is an integer between $1$ and $10^{9}$, inclusive. The sequence has to be printed in the given order (from left to right).

翻译中…

Output

翻译中…

Output the number of lines in the optimal program and the optimal penalty. Next, output the program itself, one command per line. If there are several programs with minimal penalty, output any of them (you have only to minimize the penalty).

翻译中…

样例

Input #1
7 2
1 2 2 4 2 1 2
Output #1
11 4
b=1
print(b)
a=2
print(a)
print(a)
b=4
print(b)
print(a)
b=1
print(b)
print(a)
InputCopy OutputCopy
Input #2
6 3
1 2 3 1 2 3
Output #2
9 4
c=1
print(c)
b=2
print(b)
a=3
print(a)
print(c)
print(b)
print(a)
InputCopy OutputCopy
题目信息
题号
132E
时间限制
2 s
内存限制
256 MB
标签
网络流
图论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。