QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 256 MB مجموع النقاط: 100

#22784. הוד ההרים

الإحصائيات

הפרות מבלות את הקיץ ליד Front Range ב־Rocky Mountains, לא רחוק מביתו של Coach Rob. באופק נראים $N$ הרים ($N \le 100{,}000$), למשל (כאן $N=5$):

                   /\
      /\          /  \  /\
     /  \/\    /\/    \/  \
    /    \ \  /  \    /    \
  -----------------------------

כל הר הוא משולש שווה־שוקיים שגובהו בדיוק פי שניים מאורך בסיסו. מתארים הר באמצעות קואורדינטות $x$ של שני קצות הבסיס; אלו שלמים חיוביים הנכנסים ב־16 סיביות עם סימן. חשבו את השטח הכולל של איחוד ההרים.

קלט

  • שורה 1: שלם $N$.
  • שורות $2..N+1$: כל שורה מתארת הר אחד בשני שלמים ממוינים המופרדים ברווח.

פלט

שלם אחד, שטח איחוד ההרים. השטח תמיד שלם ונכנס ב־32 סיביות עם סימן.

דוגמאות

קלט 1

5
2 7
6 9
12 15
14 21
20 25

פלט 1

114

מחבר הבעיה: Brian Dean, 2001

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.