A1182 | [COCI-2008_2009-regional]#2 CVJETICI
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
On a faraway planet, strange plants with two stems can be found. Every plant on the planet can be described by three numbers: the x-coordinates of the stems L and R, and the height H at which the stems are connect. The image depicts a plant with L=2, R=5 and H=
4.
Every day a new plant grows on the planet. The plant that grows on day 1 is of height 1, and every subsequent plant is one higher than the previous one.
When a stem of a new plant intersects the horizontal segment of another plant, a small flower grows (if one wasn't there already). If segments merely touch in a point, a flower will not grow there.
The following images are a visualization of the first example on the next page.
Write a program that, given the coordinates of all plants, calculates the number of new flower every day.
4.
Every day a new plant grows on the planet. The plant that grows on day 1 is of height 1, and every subsequent plant is one higher than the previous one.
When a stem of a new plant intersects the horizontal segment of another plant, a small flower grows (if one wasn't there already). If segments merely touch in a point, a flower will not grow there.
The following images are a visualization of the first example on the next page.
Write a program that, given the coordinates of all plants, calculates the number of new flower every day.
输入格式
The first line contains an integer N (1 ≤ N ≤ 100000), the number of days.
Each of the following N lines contains two integers L and R (1 ≤ L < R ≤ 100000), the coordinates of the stems of a plant.
Each of the following N lines contains two integers L and R (1 ≤ L < R ≤ 100000), the coordinates of the stems of a plant.
输出格式
Output N lines, the number of new flowers after each plant grows.
输入输出样例
输入 #1
4 1 4 3 7 1 6 2 6
输出 #1
0 1 1 2
输入 #2
5 1 3 3 5 3 9 2 4 3 8
输出 #2
0 0 0 3 2
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted