QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22652. 아침 운동

Statistics

매일 아침 Farmer John은 소를 헛간 밖으로 이끌어 운동시킵니다(건강한 소는 젖을 더 줍니다). 길이가 같은 두 줄이 나란해야 합니다. $2 \times N$ ($1 \le N \le 100$) 목장 띠를 준비했고 $2N$칸으로 봅니다. 준비됐다고 생각했으나 일부 칸의 나무를 잊었습니다. 소는 나무 위에 설 수 없습니다.

운동하려면 밀집해야 해 다른 목장을 쓸 수 없습니다. $2 \times [어떤 수]$ 무리 여러 개일 수도 있게 나눠 한 무리씩 운동합니다. 큰 무리를 좋아하므로 연속 $2 \times K$ 부분 띠 ($K \le N$)를 차지하면서 한 번에 최대 몇 마리인지 구합니다.

입력

  • 1번째 줄: 정수 $N$.
  • $1..N+1$번째 줄: 공백 구분 두 정수로 $1 \times 2$ 띠를 설명합니다. 나무 있으면 1, 없으면 0이며 예제가 설명합니다.

출력

  • 1번째 줄: 한 번에 운동할 수 있는 소 수 정수.

예제

입력 1

7
0 0
1 0
1 1
0 0
0 0
0 0
0 1

출력 1

6

참고

입력 설명

나무 네 개가 있는 $2\times7$ 띠입니다.

출력 설명

가장 큰 연속 무나무 부분은 $2\times3$으로 $2\times3 = 6$마리입니다.

작성자: Percy Liang, 2004.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.