We have a group of N items (represented by integers from 1 to N), and we know that there is some total order defined for these items. You may assume that no two elements will be equal (for all a, b: a<b or b<a). However, it is expensive to compare two items. Your task is to make a number of comparisons, and then output the sorted order. The cost of determining if a < b is given by the bth integer of element a of costs (space delimited), which is the same as the ath integer of element b. Naturally, you will be judged on the total cost of the comparisons you make before outputting the sorted order. If your order is incorrect, you will receive a 0. Otherwise, your score will be opt/cost, where opt is the best cost anyone has achieved and cost is the total cost of the comparisons you make (so your score for a test case will be between 0 and 1). Your score for the problem will simply be the sum of your scores for the individual test cases.
标签: represented integers group items
上传时间: 2016-01-17
上传用户:jeffery
问题描述 序列Z=<B,C,D,B>是序列X=<A,B,C,B,D,A,B>的子序列,相应的递增下标序列为<2,3,5,7>。 一般地,给定一个序列X=<x1,x2,…,xm>,则另一个序列Z=<z1,z2,…,zk>是X的子序列,是指存在一个严格递增的下标序列〈i1,i2,…,ik〉使得对于所有j=1,2,…,k使Z中第j个元素zj与X中第ij个元素相同。 给定2个序列X和Y,当另一序列Z既是X的子序列又是Y的子序列时,称Z是序列X和Y的公共子序列。 你的任务是:给定2个序列X、Y,求X和Y的最长公共子序列Z。
上传时间: 2014-01-25
上传用户:netwolf
B-tree 在内存中的实现,包括插入、删除、查找。
上传时间: 2013-12-09
上传用户:asasasas
单纯形法算法,int K,M,N,Q=100,Type,Get,Let,Et,Code[50],XB[50],IA,IAA[50],Indexg,Indexl,Indexe float Sum,A[50][50],B[50],C[50]
上传时间: 2013-12-22
上传用户:顶得柱
这是Kenneth C.Loudden所著<<编译原理与实践>>附录B中源码.但原书公布的下载地址已失效.故上传
上传时间: 2016-01-23
上传用户:x4587
本书以奥地利贝加莱公司的B&R 2000系列可编程计算机控制器(PCC)为背景,系统地介绍了最新的可编程控制器的工作原理、指令系统、编程方法、网络通讯等,力求将这一领域的最新技术成果介绍给读者。
上传时间: 2016-01-25
上传用户:sevenbestfei
IC卡破解,教程 可以破解一般加密的A.B类智能IC卡
上传时间: 2014-08-26
上传用户:wfeel
程序计算了国产矩形波导BJ-100的传输特性。通过查阅资料可以知道BJ-100波导管的结构参数为频率范围(8.2GHz~12.5GHz)结构参数a=22.86mm,b=10.16mm FDTD计算 fortran 语言
上传时间: 2014-12-02
上传用户:linlin
convert numbers from h to d or b to h
上传时间: 2014-11-17
上传用户:refent
附件程序是一个B样条程序的图形文件,读者可以直接下载到硬盘上,编译运行。
上传时间: 2016-01-26
上传用户:bjgaofei