F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Ball

Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 1933    Accepted Submission(s): 582


Problem Description
Give a chessboard of $ M*M $ , with $ N$ point on it. You should calculate how many solutions there ar to select $ 3 $ points to make the median distance between the distance between the $ 3 $ points is a prime number?

the distance between $(x1,y1)$ and $(x2,y2)$ is $|x1-x2|+|y1-y2|$
 

Input
Each test contains multiple test cases. The first line contains the number of test cases $T$($1\le T \le 10$). Description of the test cases follows.

The first line of each test case contains two integers $N,M$

The next $N$ lines each line contains two integers $x_i,y_i$

It’s guaranteed there are no $i,j(i \neq j)$ satisfies both $x_i=x_j$ and $y_i=y_j$

$1\le N \le 2000,1\le M \le 10^5,1\le x_i,y_i\le M$
 

Output
For each test case, print one integer — the answer to the problem.
 

Sample Input
2 3 3 1 1 2 2 3 3 3 3 1 1 2 1 3 2
 

Sample Output
1 1
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-10 15:08:21, Gzip enabled