 Alright guys, we're going to go over the next problem of the Code Forces Division 645A Park Lightning. So due to the coronavirus, only city authorities obligated citizens to keep a social distance. The mayor of the city, Sam Yard, wants to light up the park so that people could see each other even at night to keep the social distance. So the park has a rectangular table with M rows and M columns and each of the cells have squares and boundaries, right, so like this. Okay, so you're supposed to develop lightning for the park and you have to put lanterns in the middle of the streets. The lamp lights two squares near it and only one if it's at the border of the park. So as you can see here, if I put a lantern here, it lights two of the squares near it and if I put a lantern on the border, it only lights one of the square near it. Okay, and in here, they put one here and then they put one on the border so it only lit this light square. Here, they put one between this border so they lit these two squares, this and this. And on here, they put one on this border and they only lit this square. So Sam Yard wants to spend at least the least amount of money on lighting but also wants the people throughout the park to keep social distance so you want to find the minimum number of lanterns that are required to light all squares. Okay, this is actually not a hard problem. I'm going to explain it on pen and paper and then I'll show you guys what it means, what I did to solve this problem. Alright guys, so to do this problem, all you have to do is you have to draw out the matrix, not matrix, the whole border and then see how they got the answer. So if you look at this, they had one, two, three, four, four by one, two, three, four, five. They have four by five. So four rows, one, two, three, four and then one, two, three, four, five. Yeah, I think that's one, two, three, four, five. Yeah, five. Okay, so n is equal to four and then m is equal to five. And basically, if you put a lamp on the side, not on the side, in between two squares, it would light both of the squares, right? And you want the minimum number of lanterns it takes. So all you have to do is literally just put a lantern between every single one so they lit two squares instead of one. So here, if I put one here, I'll lit both of these. If I put one here, I'll lit both of these. If I put one here, I'll put one here. If I put one here, I'll lit both of these. Put one here it lit both of these. And then now the leftover ones you have to just put one in every single one of those. But remember, we could put one in between the two squares and then I would lit both of them. So if I put one here. Okay, so if I lit, put one here, lit both of these. So lit both of these, and then put one here, it'll lit both of these. So now let's count how many dots we used, how many lanterns we used. We used one, two, three, four, five, six, seven, eight, nine, and then 10. So we had 10 lanterns. Okay, so based on this, basically all we did was just pretty much took every single two squares, we put one lantern. So all we have to do is just find the total number of squares and then put a lantern for every two squares. So that's how we did it. So to find the total number of squares, you take n times m, and I'll give you the area of total number of squares. So n times m is going to be equal to 20. And then all you have to do is just for every two between this area, 20 divided two is 10. So that's how we got 10 lanterns here. There's another test case, which is if you, which is if it's not, not even, then you would have to, if the area is not even, if number of squares is not even. So in that case, let's look at the other ones. So like right here, and one by three is n equals equal to one, m is equal to three. Right, it's not even. Let's say I put one here, and I'll cover up these two. Then I have one square left. So to do that, I have to put another lantern for that. So that'll get that. So if it's not even, I would just take, find the number of squares, right? So number of squares is n times m, which is equal to one times three, which is equal to three. And then I would just have to divide by two. Remember, we were still gonna divide by two for every two square. But then all I have to do is just add one for the last square. So I'm gonna take three divided by two, which would give me one, right? Lower bound three divided by two, which would give me one. And then that's for this, for every two squares. And then I would just have to add one. That could be two. So this would give you two lanterns. Right, that's all you have to do. And then there's actually one last test case, which is if you have just one square, and if it's just one square, you just have one. Right, that's it. If it's one square and it's one m is equal to one, then we just have one, put one lantern. Yeah, that's it. I'll show you the code now, and then that's pretty much it. All right, guys. So then this is the test case, not test case. This is the code that I did. So here we have read in, I read in the number of test cases and then I did a while loop for each test case. I read in the number rows and m, number rows and number of column trees, n, n, m. I found the area by n times m. Then I check if the area is one, then we just have to print out one. Otherwise, I check if it's the areas even. If the area is even, we just divide by two, just like in that last test case, four times five is 20 divided by two is 10. So that's what we did here. And then if it's odd, if the area, mod by two is equal to one, which means it's odd, then I just divide by two and add one. So yeah, that's all we have to do. Great, come subscribe. I'll do the next problem and then I'll check you guys later. Peace.