2022.2.12

题目网址:

http://noi.openjudge.cn/ch0206/687/

原题:

Color Tunnels

总时间限制:

1000ms

内存限制:

65536kB

描述

A company producing toys has a complex system to paint its products. To obtain the desired color, the product must be painted by several colors in a specified order. A product is painted by moving through color tunnels. For each color there is at least one tunnel that paints with that color, but there may be more. The tunnels are distributed in the painting area and the product must be delivered from one tunnel to another in order to be painted with the given colors. The product is at a certain point in the production plant when painting process starts and must finally be delivered to the product warehouse.

More formally, a finished uncolored product is at a certain given point (source point) and must be delivered to another given point (destination point) after being painted with different colors in a given order. There are several tunnels, each is assumed to be a line segment in the plain with a specific color. The colors of the tunnels are not necessarily distinct. Let < c1, c2, ..., cn > be the sequence of n colors that the product is to be painted with. The product is required to pass through tunnels < t1, t2, ... tn > such that the color of ti is ci. Note that it is possible to pass through a tunnel without being painted, so the mentioned < t1, t2, ... tn > may be in fact a subsequence of the tunnels which the product passes through. The direction in which the product passes a tunnel is not important. The goal is to find the shortest path from source to destination subject to the color constraints. The path may cross itself, or even cross a tunnel. Passing twice (or more) through a tunnel is also allowed. Note that two tunnels can cross or overlap but are different.

输入

The input file contains several test cases. The first line of the input consists of a single integer t (between 1 and 20), the number of test cases. Following the first line is the data for t test cases. The first line of each test case contains four real numbers xs, ys, xt, yt which are x and y coordinates of the source and destination respectively. The second line of the test case contains the color sequence: the first number is the length of the sequence (between 1 and 30), and the rest of the line is the sequence itself. Each color in the sequence is an integer in the range 1...100. The third line contains a single integer n in the range 1...60 which is the number of tunnels followed by n lines each containing five numbers. The first two numbers are the x and y coordinates of one end of the tunnel. The third and fourth numbers are the x and y coordinates of the other end. Coordinates are real numbers. The fifth number is an integer in the range 1...100

输出

The output file must have t lines, each containing the minimum length of a path from source to destination subject to the constraints of the problem. The length will be compared to optimal length within a precision of three digits after decimal point.

翻译:

描述:

一个生产玩具的公司有一个用来画他们的产品的复杂的系统。为了获得所期望的颜色,产品必须以一个特定的次序用几种颜色画。一个产品通过颜色隧道被移动。对于每种颜色至少一个隧道是画那种颜色的,但是可能这个隧道画更多的颜色。这些隧道被分配在画画区域并且为了被画上被给的颜色,产品必须从一个隧道被运送到另一个隧道。当画画处理开始并且最后必须被运送到产品仓库时,产品在一个生产工厂的特定的一个点。

更正式的来说,一个完成的没有着色的产品在一个特定的被给定的点(原点)并且在被以一定的次序画上不同的颜色之后必须被运送到另一个被给定的点(目标点)。这里有几个隧道,每个都被假定为有一个特定颜色的平原上的一部分。这些隧道的颜色不一定是不同的。让<c1,c2,...,cn>成为要画在产品上的这n种颜色的次序。产品需要穿过隧道<t1,t2,...,tn>以便于隧道ti的颜色是ci。注意也可能通过一个隧道的,但是没有被画,所以被提到的<t1,t2,...,tn>隧道可能事实上是产品通过的一个子隧道。产品通过一个隧道的方向不重要。目的是找到从原点到目标点的最短的路径,以题目的约束条件。路径可能穿过它自己,或者甚至穿过一条隧道。穿过第二次(或者更多)同一条隧道也是被允许的。注意两条隧道都能互相穿过或者重叠,但是它们仍然是不同的。

输入:

输入数据包含几组测试样例。输入的第一行包含单个的整数t(在1到20之间),是测试样例的数量。接下来第一行是测试样例的数据。每组测试样例的第一行包含4个实数xs,ys,xt,yt,其中的两组x,y分别是原点坐标和目标点坐标。测试样例的第二行包含颜色的次序:第一个数字是这个次序的长度(在1到30之间),这一行剩下的是这个次序本身。这个次序的每种颜色是一个取值1到100之间的整数。第三行包含单个取值在1到60之间的整数n,表示隧道的数量,后面n行每行包含5个数字。前面的两个数字是隧道一端的x和y坐标。第三和第四个数字是隧道另一端的x和y坐标。坐标都是实数。第五个数字是一个取值1到100之间的整数。

输出:

输出数据有t行,每行包含一条从原点到目标点的路径的最小长度,以这个问题的约束条件。该长度将在小数点后三位精度范围内与最佳长度进行比较。

Color Tunnels(翻译)相关推荐

  1. D30:Color Tunnels(彩色隧道,翻译)

    原题:OpenJudge - 687:Color Tunnels 翻译: 描述:一家生产玩具的公司有一套复杂的系统来油漆产品.为了获得所需的颜色,产品必须按照指定的顺序涂上几种颜色.每个产品都是通过颜 ...

  2. QColorDialog中Pick Screen Color、Ok、Cancel不能汉化解决

    在Qt安装目录下的Src下找到对应的qt_zh_CN.qm文件,复制到当前项目的资源文件夹中,并添加到资源中 –如果没有,则找到文件qt_zh_CN.ts,复制到当前项目中,用lrelease生成qt ...

  3. YOLOv1论文翻译解读

    <You Only Look Once: Unified, Real-Time Object Detection> 论文地址:代码地址 这是一篇2015年的关于目标检测的论文,可以算是yo ...

  4. 【CF813F】Bipartite Checking(线段树分治+可删除并查集)

    文章目录 title solution code title You are given an undirected graph consisting of n vertices. Initially ...

  5. php聚合查询,php elasticsearch 聚合查询(Aggregation)

    Elasticsearch中的聚合查询,类似SQL的SUM/AVG/COUNT/GROUP BY分组查询,主要用于统计分析场景. 这里主要介绍PHP Elasticsearch 聚合查询的写法,如果不 ...

  6. POJ的题目分类(两个版本)

    版本一: 简单题 1000A+B Problem 1001Exponentiation 1003 Hangover 1004 Financial Management 1005 I Think I N ...

  7. POJ前面的题目算法思路【转】

    1000 A+B Problem 送分题 49% 2005-5-7 1001 Exponentiation 高精度 85% 2005-5-7 1002 487-3279 n/a 90% 2005-5- ...

  8. C# GDI+ winform绘图知识总结

    一.Graphics GDI+是GDI(Windows Graphics Device Interface)的后继者,它是.NET Framework为操作图形提供的应用程序编程接口,主要用在窗体上绘 ...

  9. POJ 超详细分类

    POJ 各题算法 1000    A+B Problem            送分题     49%    2005-5-7 1001    Exponentiation         高精度   ...

最新文章

  1. 【机器学习PAI实践十】深度学习Caffe框架实现图像分类的模型训练
  2. OA系统常见的审批流程
  3. VS 2005/2008 开发工具中 使用正则表达式查找替换的使用说明
  4. IDEA对新建java线程池的建议
  5. Java RandomAccessFile seek()方法与示例
  6. 头顶距离顶部百分比_近距离接触COLMO子母太空舱洗衣机:“真分区洗”应该什么样...
  7. Android studio每次启动卡在fetching Android sdk compoment information的解决方案
  8. C++_结构体的定义和使用_结构体数组---C++语言工作笔记025
  9. luoguP3799 妖梦拼木棒 [组合数学]
  10. 关于在Eclipse里面启动了服务,但是localhost:8080无法访问的问题:
  11. 安卓应用,在吾手机上正常,在另外手机上崩溃,因为缺少so库
  12. 软件体系结构 复习题
  13. Cadence如何画PCB封装库
  14. 【无标题】2022电工(技师)操作证考试题及在线模拟考试
  15. RS232 RS422 RS485详细介绍
  16. 阿里云oos对象存储 上手快速入门
  17. 我的Go+语言初体验——Demo游戏体验篇(直男程序员的真实体验)
  18. 二维码图片生成 hutool
  19. 转载:“只要3分钟,我就能扒光你的隐私!” | 互联网时代,14亿中国人都在裸奔|你的隐私已不是隐私
  20. M OP N数值运算问题

热门文章

  1. Linux ❉ 权限位rwx
  2. 【中继功率分配】基于MATLAB的中继功率分配算法仿真
  3. 什么是C103M日内阴线多于阳线选股指标?
  4. fastadmin 微信H5支付返回格式
  5. 计算机毕业设计springboot健身俱乐部会籍管理系统cbz46源码+系统+程序+lw文档+部署
  6. 课堂教学的动态生成与教师回应策略的研究课题申请•评审书
  7. 陈广琛谈TechEd2009
  8. 【暑期每日一题】洛谷 P1554 梦中的统计
  9. 计算机专业的口号运动会四字,常用运动会四字口号
  10. CRM系统,让销售人员识别客户真实需求!