A9277 | Blocked Points
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Imagine you have an infinite 2D plane with Cartesian coordinate system. Some of the integral points are blocked, and others are not. Two integral points $A$ and $B$ on the plane are 4-connected if and only if:
- the Euclidean distance between $A$ and $B$ is one unit and neither $A$ nor $B$ is blocked;
- or there is some integral point $C$ , such that $A$ is 4-connected with $C$ , and $C$ is 4-connected with $B$ .
Let's assume that the plane doesn't contain blocked points. Consider all the integral points of the plane whose Euclidean distance from the origin is no more than $n$ , we'll name these points special. Chubby Yang wants to get the following property: no special point is 4-connected to some non-special point. To get the property she can pick some integral points of the plane and make them blocked. What is the minimum number of points she needs to pick?
- the Euclidean distance between $A$ and $B$ is one unit and neither $A$ nor $B$ is blocked;
- or there is some integral point $C$ , such that $A$ is 4-connected with $C$ , and $C$ is 4-connected with $B$ .
Let's assume that the plane doesn't contain blocked points. Consider all the integral points of the plane whose Euclidean distance from the origin is no more than $n$ , we'll name these points special. Chubby Yang wants to get the following property: no special point is 4-connected to some non-special point. To get the property she can pick some integral points of the plane and make them blocked. What is the minimum number of points she needs to pick?
输入格式
The first line contains an integer $n$ $(0<=n<=4·10^{7})$ .
输出格式
Print a single integer — the minimum number of points that should be blocked.
输入输出样例
输入 #1
1
输出 #1
4
输入 #2
2
输出 #2
8
输入 #3
3
输出 #3
16
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted