#649
Silver IV
Cowntact Tracing 2
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Farmer John has NN cows in a line (1N31051 \leq N \leq 3\cdot 10^5). Unfortunately, there is a sickness spreading throughout.

Initially, some cows start off infected. Every night, an infected cow spreads the sickness to the cows on their left and right (if they exist). Once a cow is infected, she stays infected.

After some amount of nights, Farmer John realizes that the issue has gotten out of control, so he tests his cows to determine who has the sickness. Find the minimum number of cows that could have started with the sickness.

입력

The first line contains NN, the number of cows that Farmer John has.

The next line contains an NN character bitstring of only 11s and 00s where a 11 represents an infected cow and a 00 represents an uninfected cow after some number of nights.

출력

Output a single integer: the minimum number of cows that could have started with the sickness.

예제 입력 1

5
11111

예제 출력 1

1

예제 입력 2

6
011101

예제 출력 2

4

점수

Inputs 3-7: N1000N \le 1000Inputs 8-12: No additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Silver IV1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.