Nastya and Scoreboard

Denis, after buying flowers and sweets (you will learn about this story in the next task), went to a date with Nastya to ask her to become a couple. Now, they are sitting in the cafe and finally… Denis asks her to be together, but … Nastya doesn’t give any answer.

The poor boy was very upset because of that. He was so sad that he punched some kind of scoreboard with numbers. The numbers are displayed in the same way as on an electronic clock: each digit position consists of 7 7 7 segments, which can be turned on or off to display different numbers. The picture shows how all 10 10 10 decimal digits are displayed:
在这里插入图片描述

After the punch, some segments stopped working, that is, some segments might stop glowing if they glowed earlier. But Denis remembered how many sticks were glowing and how many are glowing now. Denis broke exactly k k k segments and he knows which sticks are working now. Denis came up with the question: what is the maximum possible number that can appear on the board if you turn on exactly k k k sticks (which are off now)?

It is allowed that the number includes leading zeros.

Input

The first line contains integer n ( 1 ≤ n ≤ 2000 ) n (1≤n≤2000) n(1n2000) — the number of digits on scoreboard and k ( 0 ≤ k ≤ 2000 ) k (0≤k≤2000) k(0k2000) — the number of segments that stopped working.

The next n n n lines contain one binary string of length 7 7 7, the i i i-th of which encodes the i i i-th digit of the scoreboard.

Each digit on the scoreboard consists of 7 7 7 segments. We number them, as in the picture below, and let the i i i-th place of the binary string be 0 0 0 if the i i i

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值