308622: CF1548D1. Gregor and the Odd Cows (Easy)

Memory Limit:256 MB Time Limit:6 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Gregor and the Odd Cows (Easy)

题意翻译

给一个网格图,上面有 $n$ 个点,保证不存在三点共线且每个点都在格点上,询问有多少个三元组 $(p_1,p_2,p_3)(1\le p_1<p_2<p_3\le n)$ 满足由 $p_1,p_2,p_3$ 三个点构成的三角形的面积是整数,并且内部(不包含边界)的格点数量是奇数。 **保证所有点的 $x$ 和 $y$ 坐标都为偶数。**

题目描述

This is the easy version of the problem. The only difference from the hard version is that in this version all coordinates are even. There are $ n $ fence-posts at distinct coordinates on a plane. It is guaranteed that no three fence posts lie on the same line. There are an infinite number of cows on the plane, one at every point with integer coordinates. Gregor is a member of the Illuminati, and wants to build a triangular fence, connecting $ 3 $ distinct existing fence posts. A cow strictly inside the fence is said to be enclosed. If there are an odd number of enclosed cows and the area of the fence is an integer, the fence is said to be interesting. Find the number of interesting fences.

输入输出格式

输入格式


The first line contains the integer $ n $ ( $ 3 \le n \le 6000 $ ), the number of fence posts which Gregor can choose to form the vertices of a fence. Each of the next $ n $ line contains two integers $ x $ and $ y $ ( $ 0 \le x,y \le 10^7 $ , $ x $ and $ y $ are even), where $ (x,y) $ is the coordinate of a fence post. All fence posts lie at distinct coordinates. No three fence posts are on the same line.

输出格式


Print a single integer, the number of interesting fences. Two fences are considered different if they are constructed with a different set of three fence posts.

输入输出样例

输入样例 #1

3
0 0
2 0
0 4

输出样例 #1

1

输入样例 #2

5
0 0
2 16
30 14
4 6
2 10

输出样例 #2

3

说明

In the first example, there is only $ 1 $ fence. That fence is interesting since its area is $ 4 $ and there is $ 1 $ enclosed cow, marked in red. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1548D1/0403ceae6e73450fcff5ed53159c4a8d4ef6577c.png)In the second example, there are $ 3 $ interesting fences. - $ (0,0) $ — $ (30,14) $ — $ (2,10) $ - $ (2,16) $ — $ (30,14) $ — $ (2,10) $ - $ (30,14) $ — $ (4,6) $ — $ (2,10) $

Input

题意翻译

给一个网格图,上面有 $n$ 个点,保证不存在三点共线且每个点都在格点上,询问有多少个三元组 $(p_1,p_2,p_3)(1\le p_1<p_2<p_3\le n)$ 满足由 $p_1,p_2,p_3$ 三个点构成的三角形的面积是整数,并且内部(不包含边界)的格点数量是奇数。 **保证所有点的 $x$ 和 $y$ 坐标都为偶数。**

加入题单

上一题 下一题 算法标签: