|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||0||0||0||0.000%|
An airline called Divided Airlines has recently made the news due to their tendency to overbook their flights rather aggressively. For some flights, they even resorted to dragging passengers out from the plane! This was of course not very popular, so they decided to "resolve" the issue by making the seating assignments very chaotic (airlines do like unnecessary complexity).
A particular flights has $n$ passengers. The seats are divided into $r$ rows each containing $c$ seats. Every passenger $i$ is assigned to some particular seat located at row $a_i$ and column $b_i$. However, some passengers may be assigned to the same seat.
Of course, passengers are usually okay with sitting somewhere else than their assigned seat, but they may still want to be somewhat close to their original seat. Perhaps they want to be able to speak to their friends, or sit close to their overhead luggage. More specifically, passenger $i$ accepts sitting at most $s_i$ rows away from the row on their ticket.
Due to budget reasons, you decided to travel on a Divided flight. As expected, all the passengers assigned to an overbooked seat started to fight with each other, moving around in complex ways and causing a long delay. You proposed a fair resolution: you will construct a seat assignment which takes into account how far the passengers accepts to sit from their assigned seats so that as many passengers as possible get a seat. Now, all that remains is to actually find this assignment.
The input consists of:
Output the maximum number of passengers that can be assigned a seat in an optimal assignment.
3 2 1 1 1 0 1 1 1 2 1 0
3 3 1 1 1 0 1 1 1 1 1 2
5 2 2 1 1 0 1 2 0 1 2 0 1 1 1 2 1 1