CF392A.Blocked Points
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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?
假设你有一个无限大的二维平面,其上建立了笛卡尔坐标系。平面上的部分整数坐标点被阻塞(blocked),其余点未被阻塞。平面上的两个整数坐标点 A 和 B 是4-连通的,当且仅当满足以下条件之一:
- A 与 B 的欧几里得距离为 1,且 A 和 B 均未被阻塞;
- 或存在某个整数坐标点 C,使得 A 与 C 是 4-连通的,且 C 与 B 是 4-连通的。
现在假设整个平面不包含任何被阻塞的点。考虑所有到原点的欧几里得距离不超过 n 的整数坐标点,我们将这些点称为特殊点。Chubby Yang 希望实现如下性质:任意特殊点都不与任何非特殊点 4-连通。为达成该性质,她可以选取平面上的一些整数坐标点并将它们设为被阻塞的点。问:她至少需要阻塞多少个点?
输入格式
The first line contains an integer n (0 ≤ n ≤ 4·107).
第一行包含一个整数 $ n ( 0 \leq n \leq 4\cdot10^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
输入解题思路,AI测评打分。不知道怎么写?