CF552A.Vanya and Table

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vanya has a table consisting of 100100 rows, each row contains 100100 cells. The rows are numbered by integers from 11 to 100100 from bottom to top, the columns are numbered from 11 to 100100 from left to right.

In this table, Vanya chose nn rectangles with sides that go along borders of squares (some rectangles probably occur multiple times). After that for each cell of the table he counted the number of rectangles it belongs to and wrote this number into it. Now he wants to find the sum of values in all cells of the table and as the table is too large, he asks you to help him find the result.

输入格式

The first line contains integer nn ( 1<=n<=1001<=n<=100 ) — the number of rectangles.

Each of the following nn lines contains four integers x1,y1,x2,y2x_{1},y_{1},x_{2},y_{2} ( 1<=x1<=x2<=1001<=x_{1}<=x_{2}<=100 , 1<=y1<=y2<=100)1<=y_{1}<=y_{2}<=100) , where x1x_{1} and y1y_{1} are the number of the column and row of the lower left cell and x2x_{2} and y2y_{2} are the number of the column and row of the upper right cell of a rectangle.

输出格式

In a single line print the sum of all values in the cells of the table.

输入输出样例

  • 输入#1

    2
    1 1 2 3
    2 2 3 3
    

    输出#1

    10
    
  • 输入#2

    2
    1 1 3 3
    1 1 3 3
    

    输出#2

    18
    

说明/提示

Note to the first sample test:

Values of the table in the first three rows and columns will be as follows:

121121

121121

110110

So, the sum of values will be equal to 1010 .

Note to the second sample test:

Values of the table in the first three rows and columns will be as follows:

222222

222222

222222

So, the sum of values will be equal to 1818 .

首页