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.