-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCHEFHOME.java
More file actions
53 lines (33 loc) · 905 Bytes
/
CHEFHOME.java
File metadata and controls
53 lines (33 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Akash Yadav
// @Hudson Lane, Delhi
// 17th June 18
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
class TestClass{
//https://www.codechef.com/problems/CHEFHOME
public static Scanner scn = new Scanner(System.in);
public static void main (String[] args) throws java.lang.Exception{
int T = scn.nextInt();
while(T-- > 0){
int N = scn.nextInt();
int[] pointsX = new int[N];
int[] pointsY = new int[N];
for(int i = 0; i < N; i++){
pointsX[i] = scn.nextInt();
pointsY[i] = scn.nextInt();
}
long ansX = getAns(pointsX);
long ansY = getAns(pointsY);
long ans = ansX * ansY;
System.out.println(ans);
}
}
public static long getAns(int[] points){
Arrays.sort(points);
int N = points.length;
long ans = points[N/2] - points[(N - 1)/2] + 1;
return ans;
}
}