QOJ.ac

QOJ

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

#22320. יצירת אגם

Statistics

Farmer John רוצה עזרת פרות ביצירת אגם. ממפה מרעה עם $R$ שורות ($3\le R\le100$), $C$ עמודות ($3\le C\le100$) ריבועים שש על שש רגל, גובה ממוצע באינץ׳ ($10\le elev_{rc}\le5000$).

אימן ״חפירה בדריכה״. עדר חזק מכסה בדיוק $3\times3$, עובר לפינה שמאלית עליונה $R_s,C_s$ ($1\le R_s\le R-2;1\le C_s\le C-2$), מוריד $D_s$ אינץ׳ ($1\le D_s\le40$). נמוכות מחכות לשאר שיגיעו לגובהן, ולכן לא כולן נדרכות או חלק פחות.

גבהים ראשוניים, $N$ הוראות מסודרות ($1\le N\le20000$), מפלס $E$ ($0\le E\le5000$): נפח באינץ׳ מעוקב עד $2,000,000,000$. מחסומים בקצה מונעים גלישה.

מרעה $4\times6$, גבהים עם שורות/עמודות:

| שורה/עמודה | $1$ | $2$ | $3$ | $4$ | $5$ | $6$ | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | $1$ | $28$ | $25$ | $20$ | $32$ | $34$ | $36$ | | $2$ | $27$ | $25$ | $20$ | $20$ | $30$ | $34$ | | $3$ | $24$ | $20$ | $20$ | $20$ | $20$ | $30$ | | $4$ | $20$ | $20$ | $14$ | $14$ | $20$ | $20$ |

גבעה עליונה ימנית $36$, קטנה שמאלית $28$, אמצע שורה $4$ שקוע מעט. אחרי "$1\;4\;4$":

| שורה | $1$ | $2$ | $3$ | $4$ | $5$ | $6$ | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | $1$ | $28$ | $25$ | $20$ | $32$ | $32$ | $32$ | | $2$ | $27$ | $25$ | $20$ | $20$ | $30$ | $32$ | | $3$ | $24$ | $20$ | $20$ | $20$ | $20$ | $30$ | | $4$ | $20$ | $20$ | $14$ | $14$ | $20$ | $20$ |

רק שלושה תאים ירדו, שישה עדרים חיכו לגובהם שלא הגיע. אחרי "$1\;1\;10$" בשמאל העליון:

| שורה | $1$ | $2$ | $3$ | $4$ | $5$ | $6$ | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | $1$ | $18$ | $18$ | $18$ | $32$ | $32$ | $32$ | | $2$ | $18$ | $18$ | $18$ | $20$ | $30$ | $32$ | | $3$ | $18$ | $18$ | $18$ | $20$ | $20$ | $30$ | | $4$ | $20$ | $20$ | $14$ | $14$ | $20$ | $20$ |

מפלס $22$ אינץ׳ נותן עומקים:

| שורה | $1$ | $2$ | $3$ | $4$ | $5$ | $6$ | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | $1$ | $4$ | $4$ | $4$ | -- | -- | -- | | $2$ | $4$ | $4$ | $4$ | $2$ | -- | -- | | $3$ | $4$ | $4$ | $4$ | $2$ | $2$ | -- | | $4$ | $2$ | $2$ | $8$ | $8$ | $2$ | $2$ |

סך עומק $66$ כפול שש על שש רגל: $66\times72\times72=342,144$ אינץ׳ מעוקב, צלע $72$ אינץ׳.

כתבו תוכנית אוטומציה.

קלט

  • שורה $1$: $R,C,E,N$ ברווחים.

  • שורות $2,\ldots,R+1$: שורה $i+1$, שורת תאים $i$ עם $C$ שלמים ברווחים.

  • שורות $R+2,\ldots,R+N+1$: שורה $i+R+1$, הוראה $i$ עם $R_s,C_s,D_s$.

פלט

  • שורה 1: שלם, נפח האגם החדש באינץ׳ מעוקב.

דוגמאות

קלט 1

4 6 22 2
28 25 20 32 34 36
27 25 20 20 30 34
24 20 20 20 20 30
20 20 14 14 20 20
1 4 4
1 1 10

פלט 1

342144

הסבר

לפי דוגמת הטקסט.

מחבר הבעיה: Rob Kolstad, 2008

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.