Official
A - 布団の組 / Futon Pairs Editorial by admin Editorial for printing
swe-2-highOn day \(i\) there are \(A_i + B_i\) guests in total. Since one futon set serves \(2\) people, everyone pairs up exactly when this sum is even (o), and one person is left over when it is odd (x). Parity is checked via \((A_i + B_i) \bmod 2\). The program evaluates this for each day and appends o or x to a string \(s\). Because days are processed in order and characters are appended at the end, the resulting string is in the required order. The check costs \(O(1)\) per day for \(O(N)\) total time, and storing the answer string takes \(O(N)\) space.
posted:
last update: