当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6813:Last Problem

Special Judge 特殊评判
题目描述
It's the night before Zhang3's birthday, and she's preparing for her birthday party in the classroom. She has brought a huge birthday cake and some powerful tomatoes, and has decorated almost every corner of the classroom. However, the blackboard is still empty. The last thing to do is to draw a beautiful pattern on it.

The blackboard is regarded as an infinite plane, each integer point $(x, y)$ has an integer value as its color. At the very beginning, the color of every point is $0$.

Zhang3 has $n$ crayons, labeled $1, 2, \ldots, n$. Painting with the $i ^ \mathrm{th}$ crayon, you can replace the color of some chosen integer point $(x, y)$ with color $i$. It is called a step, and she will draw the pattern step by step.

According to Zhang3's judgement of beautiful patterns, there's a restriction: Just before you paint $(x, y)$ into some color $i$, the last four colors of $i$ must appear among the adjacent points of $(x, y)$. The last four colors of $i$ means colors from $(i - 4)$ to $(i - 1)$, ignoring those non-positive ones. Two integer points are adjacent if their Euclid distance is exactly one. (Note that a point is not adjacent to itself.) If the condition above is not satisfied, the step is not allowed.

Zhang3 doesn't want to waste crayons, so the final pattern should contain at least one point with color $n$. Please help her find a way to draw such a beautiful pattern.
输入解释
The only line of the input contains an integer $n \; (1 \le n \le 100)$, the number of crayons.
输出解释
Print the steps in chronological order, each in a separate line. Notice that you should not print the number of steps.

In the $i ^ \mathrm{th}$ line, print three integers $x_i, y_i, c_i$, separated by spaces, indicating the $i ^ \mathrm{th}$ step is to paint $(x_i, y_i)$ into color $c_i$.

Your answer should satisfy $|x_i|, |y_i| \le 10^9, \; 1 \le c_i \le n$. The number of steps should not exceed $10^5$. The output file should not be larger than $5 \; \text{MB}$.

It can be proved that there is always a solution. Any solution that meets all of the requirements will be accepted.
输入样例
4
输出样例
0 0 1
1 0 1
0 1 2
1 1 3
1 -1 2
1 0 4

提示
1st step: paint (0, 0) into color 1.
000
010
000

2nd step: paint (1, 0) into color 1.
0000
0110
0000

3rd step: paint (0, 1) into color 2.
0000
0200
0110
0000

4th step: paint (1, 1) into color 3.
0000
0230
0110
0000

5th step: paint (1, -1) into color 2.
0000
0230
0110
0020
0000

6th step: paint (1, 0) into color 4.
0000
0230
0140
0020
0000
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6813

最后修改于 2020-10-25T23:34:36+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 524288/524288K(Java/Others)