Official

B - 白雪の新記録 / New Snowfall Records Editorial by admin Editorial for printing

swe-2-high

Day \(i\) is a record day exactly when \(A_i\) exceeds the maximum of all previous days. The program keeps this running maximum in best: if \(A_i > best\) it updates best and appends o, otherwise it appends x. Initializing best to \(-1\) guarantees day \(1\) is always o, since \(A_i \ge 0\). Each day is processed in constant time, so the running time is \(O(N)\), and the output string uses \(O(N)\) space.

posted:
last update: