| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 41 | 30 | 19 | 65.517% |
Audrey is system administrator for miHoYo! It is her job to manage the server room and keep her favorite video game, Honkai: Star Rail, up and running.
The miHoYo server room is broken up into a single corridor of sections, some of which have servers installed. Some of the servers are already turned on.
Audrey urgently needs to turn on more servers. However, the server room has bad ventilation, so if two servers in adjacent sections are both on, then the room will overheat.
Audrey cannot turn off servers that are already on. Compute the maximum number of servers Audrey can turn on from the ones that are currently off without causing the room to overheat.
The first line of input contains a single integer, $n$ (1ドル \le n \le 3 \cdot 10^5$).
The second line of input contains a ternary string $s$ of length $n,ドル representing the room. A character of 0 represents a section with no server, a character of 1 represents a section with a server that is off, and a character of 2 represents a section with a server that is on.
It is guaranteed that the server room is not currently overheating.
Output a single number, the number of additional servers Audrey can turn on from the ones that are currently off.
7 1112111
2
3 212
0
3 101
2
ICPC > Regionals > North America > Pacific Northwest Regional > 2025 ICPC Pacific Northwest Regional > Division 2 I번