Official

O - Next STPC Editorial by tassei903


\(D\) を set で持ちます。 \(L\) 以上の \(W\) の倍数を昇順に見ていき、 \(D\) に入っていないものを見つけたらそれを出力して打ち切ればいいです。

\(O(N \log N)\) 時間で計算できます。

posted:
last update: