C - PC on the Table 解説 by spheniscine


PCs can never be placed vertically, so we can consider each row individually. We can also note that within each row, we could place \(\lfloor x / 2 \rfloor\) PCs in a “run” of \(x\) characters T. Thus, a greedy strategy that “wastes” \(0\) or \(1\) spaces at the end of each run will suffice as a solution.

投稿日時:
最終更新: