Xenia and Weights

题意翻译

# 题目描述 希妮亚有一套砝码和天平,每个砝码的重量为1到10之间的整数。希妮亚要玩一个关于天平和砝码的游戏,为此,她一个一个地给秤盘加砝码。第一个砝码放在左边,第二个在右边,第三个在左边,第四个在右边,以此类推。希妮亚想把m个砝码全部加到天平上。 简单地在天平上加砝码没啥意思,所以希妮亚制定了一些规则。首先,她不能连续把两个相同重量的砝码放在天平上。也就是说,对于第i个砝码(1<=i<m),第i个的重量应该与第i+1个的重量不同。第二,每当希妮亚在某个秤盘上加砝码,她想让这个秤盘的载重超过另一个的载重。也就是说,对应的秤盘上的重量之和必须严格大于另一个秤盘上的重量之和。 我们给希妮亚所有类型的砝码。她有无数个特定重量的砝码。你的任务是帮助希妮亚在天平上放m个砝码,或者告诉希妮亚这是不可能做到的。 # **输入输出格式** **输入格式**: 第一行包含一个由10个0和1组成的字符串:如果希妮亚有i千克重量,那么该行中的i(i>=1)字符为“1”,否则该字符为“0”。第二行包含整数m(1<=m<=1000)。 **输出格式:** 如果能够把m个砝码在天平上按规则放置,则在第一行输出“YES”,并在下一行输出m个整数——你依次放在天平上的这些砝码的重量。否则,在第一行中输出“NO”。 如果有多个解决方案,您可以输出其中任何一个。

题目描述

Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the third one goes on the left scalepan, the fourth one goes on the right scalepan and so on. Xenia wants to put the total of $ m $ weights on the scalepans. Simply putting weights on the scales is not interesting, so Xenia has set some rules. First, she does not put on the scales two consecutive weights of the same weight. That is, the weight that goes $ i $ -th should be different from the $ (i+1) $ -th weight for any $ i $ $ (1<=i&lt;m) $ . Second, every time Xenia puts a weight on some scalepan, she wants this scalepan to outweigh the other one. That is, the sum of the weights on the corresponding scalepan must be strictly greater than the sum on the other pan. You are given all types of weights available for Xenia. You can assume that the girl has an infinite number of weights of each specified type. Your task is to help Xenia lay $ m $ weights on ​​the scales or to say that it can't be done.

输入输出格式

输入格式


The first line contains a string consisting of exactly ten zeroes and ones: the $ i $ -th $ (i>=1) $ character in the line equals "1" if Xenia has $ i $ kilo weights, otherwise the character equals "0". The second line contains integer $ m $ $ (1<=m<=1000) $ .

输出格式


In the first line print "YES", if there is a way to put $ m $ weights on the scales by all rules. Otherwise, print in the first line "NO". If you can put $ m $ weights on the scales, then print in the next line $ m $ integers — the weights' weights in the order you put them on the scales. If there are multiple solutions, you can print any of them.

输入输出样例

输入样例 #1

0000000101
3

输出样例 #1

YES
8 10 8

输入样例 #2

1000000000
2

输出样例 #2

NO