home
compete
practice
rank
blog
LOGIN
Practice
>>
Rectangle Union
Rectangle Union
Time Limit:
2 sec
Memory Limit:
256 MB
Attempts:
198
Accuracy:
6.06%
Author:
savish bedi
Problem Statement
My Submissions
All Submissions
You are given
n
points on the cartesian coordinate system numbered from
1
to
n
,
(x
1
,y
1
) , (x
2
,y
2
) ,..........(x
n
,y
n
).
There are
n
rectangles on the coordinate plane numbered from
1
to
n
.
(0, 0)
and
(x
i
, y
i
)
are the opposite corners of the
i
th
rectangle.
Find the union of area of all the rectangles.
Input Format:
The first line of the input contains a single integer
T
denoting the number of test cases.
The first line of each test case contains one integer
n
The following
n
lines consists of two integers
x
i
, y
i
denoting the
x
coordinate and
y
coordinate of the
i
th
point.
Output Format:
Print one integer — the union of area of the rectangles.
Constraints:
1 ≤
T
≤ 30
1 ≤
n
≤ 10
5
1 ≤
x
i
, y
i
≤ 10
6
Sample Input:
2
2
1 2
2 1
3
2 1
3 3
4 2
Sample Output:
3
11
Log In
ID
SUBMITTED AT
STATUS
LANGUAGE
TIME
MEMORY USED
See More
USER
TIME
STATUS
LANGUAGE
TIME
MEMORY USED
AnuragP
6 months ago
java
0.00 sec
0 KB
pro-Garg-Mmer
1 year ago
cpp
0.10 sec
900 KB
meetcshah19
1 year ago
java
4.15 sec
444 KB
meetcshah19
1 year ago
java
2.79 sec
444 KB
Redindian
1 year ago
cpp14
0.12 sec
672 KB
machhra
1 year ago
java
0.54 sec
444 KB
Redindian
1 year ago
cpp
0.00 sec
0 KB
Redindian
1 year ago
cpp
0.00 sec
0 KB
Redindian
1 year ago
cpp
0.00 sec
0 KB
Redindian
1 year ago
cpp
0.00 sec
0 KB
Redindian
1 year ago
cpp
0.00 sec
0 KB
kmrinal19
1 year ago
cpp
2.01 sec
744 KB
chiragsethiya
1 year ago
cpp14
0.09 sec
388 KB
vinay2001
1 year ago
cpp14
0.07 sec
64 KB
div794
1 year ago
cpp14
0.59 sec
996 KB
div794
1 year ago
cpp14
2.00 sec
5704 KB
div794
1 year ago
cpp14
0.07 sec
64 KB
div794
1 year ago
cpp14
0.07 sec
64 KB
div794
1 year ago
cpp14
0.07 sec
64 KB
vinay2001
1 year ago
cpp14
0.07 sec
64 KB
div794
1 year ago
cpp14
2.01 sec
5088 KB
alienk
1 year ago
cpp
0.00 sec
0 KB
alienk
1 year ago
cpp
0.00 sec
0 KB
alienk
1 year ago
cpp
0.00 sec
0 KB
aryanbidani
1 year ago
cpp14
0.07 sec
64 KB
chiragsethiya
1 year ago
cpp14
0.10 sec
644 KB
chiragsethiya
1 year ago
cpp14
0.09 sec
388 KB
chiragsethiya
1 year ago
cpp14
0.09 sec
388 KB
chiragsethiya
1 year ago
cpp
0.10 sec
900 KB
chiragsethiya
1 year ago
cpp
0.09 sec
648 KB
alienk
1 year ago
cpp
2.00 sec
312 KB
YatinK
1 year ago
cpp14
0.07 sec
64 KB
pranavgupta19
1 year ago
cpp14
0.07 sec
64 KB
UnmeshKumar
1 year ago
cpp14
0.07 sec
64 KB
anupam1262
1 year ago
cpp14
0.12 sec
1236 KB
anupam1262
1 year ago
cpp14
0.13 sec
972 KB
anupam1262
1 year ago
cpp
0.00 sec
0 KB
goenka1802
1 year ago
cpp
0.10 sec
480 KB
goenka1802
1 year ago
cpp
0.07 sec
64 KB
gurdeepsingh
1 year ago
cpp14
0.07 sec
64 KB
gurdeepsingh
1 year ago
cpp
0.07 sec
64 KB
silvermist
1 year ago
cpp14
0.09 sec
644 KB
silvermist
1 year ago
cpp
0.00 sec
0 KB
silvermist
1 year ago
cpp
0.07 sec
64 KB
silvermist
1 year ago
cpp
0.07 sec
64 KB
bugsbunny0
1 year ago
cpp14
0.17 sec
4164 KB
LEADERBOARD
See More
RECENT
See More