Oriental P.A.D.A.K
Time limit1sMemory limit512 MB
Given a grid where sauce spreads from K cells each second, find the minimum and maximum pieces dippers can eat when both groups race to eat.
Problem
Oz Food, a restaurant company, developed the ultimate dish 'Oriental P.A.D.A.K' (hereafter Padak). Padak is chicken topped with crisp green onions, then doused with 'Oriental soy sauce' that has an East Asian flavor.
Seunghyeong and Seongjun, Oz Food's promotional ambassadors, invited their friends to taste Padak. Seunghyeong poured the 'Oriental soy sauce' as the Oz Food manual says, and this small act turned into a fight. Seongjun prefers to dip every dish in sauce, so he was horrified by Seunghyeong's move. The followers of Seongjun (nicknamed the dippers) all blamed Seunghyeong. In response, Seunghyeong's followers (nicknamed the pourers) all blamed Seongjun.
Seongjun shouted, 'If we wait, the sauce will spread further, so let's eat fast!' and urged the dippers to eat Padak quickly. Seunghyeong pushed the pourers to eat quickly too. The dippers pick up chicken pieces that have not touched the sauce and dip them before eating. The pourers pick up chicken pieces that have already touched the sauce and eat them. Every friend, including Seunghyeong and Seongjun, can eat at most one chicken piece per second, and whenever a piece is available, they always pick one up and eat it.
The 'Oriental P.A.D.A.K' is packed in a box shaped like a grid with rows and columns, and each cell holds one chicken piece. Seunghyeong has already poured sauce, so the chicken pieces are already soaked in sauce. Every second, the sauce spreads from each cell to its four neighbors (up, down, left, and right) and soaks the chicken pieces it reaches. Sauce in cells without chicken spreads in the same way. The sauce spreads after the friends have eaten their pieces. In time order, this means: friends eat chicken pieces, then the sauce spreads, then friends eat chicken pieces, and so on.
The pourers, including Seunghyeong, number in total, and the dippers, including Seongjun, number in total. Seongjun realized that the number of chicken pieces the dippers can eat depends on which pieces they pick. Help Seongjun by writing a program that finds the maximum and minimum number of chicken pieces the dippers can eat in total.
Input
The first line contains the number of rows of the Padak box, the number of columns , the number of cells where Seunghyeong poured sauce , the number of pourers , and the number of dippers . (, , )
From the second line onward, the next lines each contain a position , where Seunghyeong poured sauce. This means he poured sauce on the chicken piece that is -th from the top and -th from the left. (, )
All positions where sauce was poured are distinct.
Output
Print, on the first line, the minimum and maximum total number of chicken pieces the dippers can eat.