QOJ.ac

QOJ

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

#22784. Majestat gór

Statistics

Krowy spędzają lato w pobliżu Front Range w Rocky Mountains, niedaleko domu Coach Rob. Na horyzoncie widać $N$ gór ($N \le 100{,}000$), na przykład (tu $N=5$):

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

Każda góra to trójkąt równoramienny o wysokości dokładnie dwa razy większej od długości podstawy. Opisują ją współrzędne $x$ obu końców podstawy; są to dodatnie liczby całkowite mieszczące się w 16 bitach ze znakiem. Oblicz całkowite pole sumy tych gór.

Wejście

  • Wiersz 1: całkowite $N$.
  • Wiersze $2..N+1$: każdy opisuje jedną górę dwoma posortowanymi liczbami całkowitymi oddzielonymi spacją.

Wyjście

Jedna liczba całkowita, pole sumy gór. Pole jest zawsze całkowite i mieści się w 32 bitach ze znakiem.

Przykład

Wejście 1

5
2 7
6 9
12 15
14 21
20 25

Wyjście 1

114

Autor zadania: 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.