Official

A - Seat Occupation Editorial by evima


Everyone can take a seat in every possible way to choose seats if and only if there is no way to specify seats to make someone leave. Additionally, only \(2\)-person groups may leave, and groups that come later are more likely to leave, so let us try to make the last \(2\)-person group leave.

For this, it is optimal to ask the earlier groups to sit from left to right in order, one seat apart from each other. Then, let us see if two or more seats remain. More specifically, the answer is Yes if \(L-\sum_{i=1}^{k-1} (a_i+1)\geq 2\), where the \(k\)-th group is the last \(2\)-person group.

This condition can also be rearranged into \(2k\leq N+1\) (\(k\) is \(1\)-indexed).

posted:
last update: