A1143 | [COCI-2007_2008-regional]#4 PLATFORME
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
A level is being designed for a new platform game. The locations of the platforms have been chosen.
Contrary to popular opinion, platforms can't float in the air, but need pillars for support. More precisely, each of the two ends of the platform needs to be supported by a pillar standing on the floor or on a different platform.
You will be given the locations of the platforms in a coordinate system as in the left image below. Each platform's location is determined by its altitude (vertical distance from the ground) and the start and end coordinates in the horizontal direction. Each support pillar is placed half a unit from the end of a platform, as in the right image.
Determine the total length of pillars needed to support all the platforms.
Contrary to popular opinion, platforms can't float in the air, but need pillars for support. More precisely, each of the two ends of the platform needs to be supported by a pillar standing on the floor or on a different platform.
You will be given the locations of the platforms in a coordinate system as in the left image below. Each platform's location is determined by its altitude (vertical distance from the ground) and the start and end coordinates in the horizontal direction. Each support pillar is placed half a unit from the end of a platform, as in the right image.
Determine the total length of pillars needed to support all the platforms.
输入格式
The first line contains the integer N, 1 ≤ N ≤ 100, the number of platforms.
Each of the following N lines contains the position of one platform, three coordinates Y, X1 and X2 .
The first number is the altitude, the other two the horizontal coordinates. All coordinates will be positive integers less than 10000 satisfying X2 > X1+1 (i.e. the length of each platform will be at least 2).
The input will be such that no two platforms overlap.
Each of the following N lines contains the position of one platform, three coordinates Y, X1 and X2 .
The first number is the altitude, the other two the horizontal coordinates. All coordinates will be positive integers less than 10000 satisfying X2 > X1+1 (i.e. the length of each platform will be at least 2).
The input will be such that no two platforms overlap.
输出格式
Output the total length of pillars needed to support all the platforms.
输入输出样例
输入 #1
3 1 5 10 3 1 5 5 3 7
输出 #1
14
输入 #2
5 50 50 90 40 40 80 30 30 70 20 20 60 10 10 50
输出 #2
200
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted