| UTPC Contest 02-05-21 Div. 1 (Advanced) |
|---|
| Закончено |
Justin the frog is hopping between lily pads. He starts at lily pad $$$0$$$, and there are $$$L + 1$$$ total lily pads. He can do one of two things:
Justin must land on a lily pad after every jump, or he will fall into the water. Today, Justin is hungry and he notices that there are $$$F$$$ flies on some lily pads. If Justin can make it to those lily pads somehow, he will be able to eat the flies. However, due to his restrictive movement, he may not be able to reach all lily pads. Help Justin determine how many flies he can reach!
The first line of the input will contain $$$N (1 \le N \le 100), M (1 \le M \le 100)$$$, and $$$L (1 \le L \le 10^4)$$$, which detail the number of pads $$$N$$$ that Justin can move forward in a jump, the number of pads $$$M$$$ that Justin can move backward in a jump, and the number of the very last lily pad.
The next line of the input will have a single integer $$$F$$$ $$$(1 \le F \le 100)$$$, the number of flies.
The next $$$F$$$ lines will each contain a single integer $$$f_i$$$ where $$$0 \le f_i \le L$$$, the location of the $$$i^{th}$$$ fly.
A single integer $$$f$$$, the number of flies that Justin can snack on. Note that this is the number of flies that Justin can reach, not the number of flies Justin can snack on in one trip.
4 2 100 4 1 2 3 4
2
| Название |
|---|


