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.