Eungae (EASY)
Time limit2sMemory limit1024 MB
Members stand in a circle, and a member greets next round only if exactly one neighbor greeted this round. Count the greeters after K rounds.
- Level
Easy3 of 10
- Topics
- Simulation, Array
- Solved
- No attempts yet
Problem
This problem is the same as Eungae (HARD) except for the constraints on , , and .
Every member of the SCSC club is an Eungae. Each Eungae greets others with Eungae! whenever it sees another person.
When a person greets with Eungae!, the friends on both sides must also greet with Eungae!. However, if someone receives Eungae! from both sides at the same time, they become so flustered that they forget to greet and cannot greet at all.
There are SCSC club members standing in a circle. At the start, of them greet with Eungae!. After rounds of greetings, find the number of people who will greet in the next round.
Everyone greets at the same time. The members are numbered from to in clockwise order.
Input
The first line contains , , and separated by spaces.
From the second line, lines follow, each containing the number of a person who greets first, one per line. The same input is not given more than once.
Output
Print the number of people who will greet in the next round after rounds of greetings.