A14433 | Gregor and the Odd Cows (Easy)
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
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.
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)$
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)$
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted