1257: Ball

内存限制:512 MB 时间限制:4.000 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:1 通过:0 通过率:0%

题目描述

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|

输入格式

Each test contains multiple test cases. The first line contains the number of test cases T(1 ≤ T ≤ 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 xi , yi 
It’s guaranteed there are no i, j(i != j) satisfies both xi = xj and yi = yj 
1 ≤ N ≤ 2000, 1 ≤ M ≤ 105 , 1 ≤ xi , yi ≤ M

输出格式

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

输入样例 复制

2
3 3
1 1
2 2
3 3
3 3
1 1
2 1
3 2

输出样例 复制

1
1

分类标签