QOJ.ac

QOJ

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

#22784. 壯麗群山

Statistics

牛群正在洛磯山脈 Front Range 附近度夏,離 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.