A8671 | Challenging Balloons
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Martha — as a professional problemsetter — proposed a problem for a world-class contest. This is the problem statement:
Tomorrow is Nadia's birthday, and Bardia (her brother) is assigned to make the balloons ready!
There are $n$ balloons (initially empty) that are tied to a straight line on certain positions $x_{1},x_{2},...,x_{n}$ . Bardia inflates the balloons from left to right. As a result, $i$ -th balloon gets bigger and bigger until its radius reaches the pressure endurance $p_{i}$ or it touches another previously-inflated balloon.
While Bardia was busy with the balloons, he wondered "What will be the sum of radius of balloons after all of the balloons are inflated?". Being a nerdy type of guy, he is now thinking about the problem instead of preparing his sister's birthday. Calculate the answer to Bardia's problem so that Nadia's birthday won't be balloon-less.
Artha — Martha's student — claimed his solution got accepted. Martha (being his teacher for a long time!) knew he couldn't have solved the problem for real and thus thinks there is something wrong with the testcases. Artha isn't anyhow logical, which means there is no way for Martha to explain the wrong point in his algorithm. So, the only way is to find a testcase to prove him wrong!
Artha's pseudo-code is shown below:
You should output a small testcase for the problem such that Artha's algorithm is incorrect. The algorithm's output is considered correct if it differs from the correct value by no more than 1.
Tomorrow is Nadia's birthday, and Bardia (her brother) is assigned to make the balloons ready!
There are $n$ balloons (initially empty) that are tied to a straight line on certain positions $x_{1},x_{2},...,x_{n}$ . Bardia inflates the balloons from left to right. As a result, $i$ -th balloon gets bigger and bigger until its radius reaches the pressure endurance $p_{i}$ or it touches another previously-inflated balloon.
While Bardia was busy with the balloons, he wondered "What will be the sum of radius of balloons after all of the balloons are inflated?". Being a nerdy type of guy, he is now thinking about the problem instead of preparing his sister's birthday. Calculate the answer to Bardia's problem so that Nadia's birthday won't be balloon-less.
Artha — Martha's student — claimed his solution got accepted. Martha (being his teacher for a long time!) knew he couldn't have solved the problem for real and thus thinks there is something wrong with the testcases. Artha isn't anyhow logical, which means there is no way for Martha to explain the wrong point in his algorithm. So, the only way is to find a testcase to prove him wrong!
Artha's pseudo-code is shown below:
You should output a small testcase for the problem such that Artha's algorithm is incorrect. The algorithm's output is considered correct if it differs from the correct value by no more than 1.
输入格式
Please pay attention! No input will be given to your program for this problem. So you do not have to read from the input anything.
输出格式
You should output the generated small testcase (which Artha's solution doesn't get it right). It should be in the following format:
- First line must contain the only number $n$ ( $1<=n<=500$ ).
- The $i$ -th of the next $n$ lines should contain the description of the $i$ -th balloon — two space-separated integers $x_{i},p_{i}$ ( $1<=p_{i}<=10^{6}$ , $0<=x_{1}<x_{2}<...<x_{n}<=10^{6}$ ).
- First line must contain the only number $n$ ( $1<=n<=500$ ).
- The $i$ -th of the next $n$ lines should contain the description of the $i$ -th balloon — two space-separated integers $x_{i},p_{i}$ ( $1<=p_{i}<=10^{6}$ , $0<=x_{1}<x_{2}<...<x_{n}<=10^{6}$ ).
The testcase depicted in the figure above (just showing how output should be formatted):
<br></br>4<br></br>0 9<br></br>6 3<br></br>12 7<br></br>17 1<br></br>
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted