A sequence is called kkk-bag, if and only if it is put in order by some permutations of111to kkk. For example,1,2,3,2,1,3,3,2,11,2,3,2,1,3,3,2,11,2,3,2,1,3,3,2,1 is a valid333-bag sequence. Roundgod is not satisfied with kkk-bag, so she put forward part-kkk-bag, whichis a contiguous subsequence of kkk-bag. Wcy wants to know if the sequence of lengthnnn is a part-kkk-bag sequence.
A sequence is called kkk-bag, if and only if it is put in order by some (maybe one) permutations of 111 to kkk. For example, 1,2,3,2,1,3,3,2,11,2,3,2,1,3,3,2,11,2,3,2,1,3,3,2,1 is a valid 333-bag sequence. Roundgod is not satisfied with kkk-bag, so she put forward part-kkk-bag, which is a contiguous subsequence of kkk-bag. Wcy wants to know if the sequence of length nnn is a part-kkk-bag sequence.
(图片来源网络,侵删)
标签: HBC209871K-Bag题解