TouchStone
  Please Login
Login Sign Up
 Homepage  Problem Set  Examinations  Submissions  Discussions  Statistics
  • Home
  • Problem Set
  • P4738
  • Problem
  • P4738涂色面积
    Limits : Time Limit : 1000 MS   Memory Limit : 65536 KB
    Judgment Tips : 1s,64m
    Description

    给你N个矩形,这些矩形在平面坐标系中,并且以坐标系的零点为中心,它们的边都平行于坐标轴。每个矩形由宽度和高度可以唯一确定。现在对矩形进行涂色操作。下图即是样例的示意图:

    现在请你计算被涂色区域的面积。

    Input Format

    第一行包含1个整数N(1<=n<=1000000),表示矩形的个数。

    接下来N行包含两个偶数X和Y(2<=X,Y<=10000000),分别表示宽度和高度。

    Output Format

    唯一的一行,表示区域面积。

    Sample Input 1

    5
    8 4
    8 2
    2 8
    2 8
    8 8

    Sample Output 1

    64

    Sample Input 2


    2 10 
    4 4 
    2 2 
    8 8 
    6 6 

    Sample Output 2

    68

    Sample Input 3

    3
    8 2
    4 4
    2 6

    Sample Output 3

    28