公式
C - Cantrip 解説 by en_translator
Original proposer: vwxyz
Takahashi always has exactly \(k\) bags.
Therefore, he stops performing the action when:
- he has received \(k\) bags with “miss,” or
- the row has been emptied.
If \(S\) has less than \(k\) occurrences of x, he can receive all bags. If there are \(k\) or more, he can receive up to the \(k\)-th “miss” bag.
Therefore, the answer can be obtained by enumerating \(i\) such that \(S_i\) is x, and comparing the number of such indices \(i\) with \(k\).
投稿日時:
最終更新: