A8064 | Emperor's Problem
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
It happened at the times of the Great Berland Empire. Once the Emperor dreamt that the Messenger from the gods ordered to build a temple whose base would be a convex polygon with $n$ angles. Next morning the Emperor gave the command to build a temple whose base was a regular polygon with $n$ angles. The temple was built but soon the Empire was shaken with disasters and crop failures. After an earthquake destroyed the temple, the Emperor understood that he somehow caused the wrath of gods to fall on his people. He ordered to bring the wise man. When the wise man appeared, the Emperor retold the dream to him and asked "Oh the wisest among the wisest, tell me how could I have infuriated the Gods?". "My Lord," the wise man answered. "As far as I can judge, the gods are angry because you were too haste to fulfill their order and didn't listen to the end of the message".
Indeed, on the following night the Messenger appeared again. He reproached the Emperor for having chosen an imperfect shape for the temple. "But what shape can be more perfect than a regular polygon!?" cried the Emperor in his dream. To that the Messenger gave a complete and thorough reply.
- All the vertices of the polygon should be positioned in the lattice points.
- All the lengths of its sides should be different.
- From the possible range of such polygons a polygon which maximum side is minimal possible must be chosen.
You are an obedient architect who is going to make the temple's plan. Note that the polygon should be simple (having a border without self-intersections and overlapping) and convex, however, it is acceptable for three consecutive vertices to lie on the same line.
Indeed, on the following night the Messenger appeared again. He reproached the Emperor for having chosen an imperfect shape for the temple. "But what shape can be more perfect than a regular polygon!?" cried the Emperor in his dream. To that the Messenger gave a complete and thorough reply.
- All the vertices of the polygon should be positioned in the lattice points.
- All the lengths of its sides should be different.
- From the possible range of such polygons a polygon which maximum side is minimal possible must be chosen.
You are an obedient architect who is going to make the temple's plan. Note that the polygon should be simple (having a border without self-intersections and overlapping) and convex, however, it is acceptable for three consecutive vertices to lie on the same line.
输入格式
The first line contains the single number $n$ ( $3<=n<=10000$ ).
输出格式
Print "YES" (without quotes) in the first line if it is possible to build a polygon possessing the needed qualities. In the next $n$ lines print integer coordinates of the polygon vertices in the order in which they would be passed counter clockwise. The absolute value of the coordinates shouldn't exceed $10^{9}$ . No two vertices can coincide. It is permitted to print any of the possible solutions. Print "NO" if to build the polygon is impossible.
输入输出样例
输入 #1
3
输出 #1
YES 0 0 1 0 0 2
输入 #2
3
输出 #2
YES 0 1 -1 0 -1 -1
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted