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
Sherwood算法消除最坏实例,以达到对任何实例都能有好的性能的效果 文件: rd_list.c --> create a random sequence of n integers not equal to each other list.c --> create a descending sequence of n integers not equal to each other sherwood.c --> 就是该算法,静态链表的长度默认设为1000,可在宏定义处修改 用法: gcc -o sherwood sherwood.c gcc -o rd_list rd_list.c gcc -o list list.c ./rd_list s.txt 1000 产生一个长度为1000的互不相等的随机序列,保存在s.txt中 ./list s1.txt 1000 产生一个长度为1000的互不相等的降序序列,保存杂s1.txt中 ./sherwood s1.txt 运行算法,比较其中的4个算法的性能差异
上传时间: 2016-01-20
上传用户:ainimao
java做书箱管理系统,C/S结构的,数据库是access2003的
上传时间: 2014-01-16
上传用户:GavinNeko
java做的学生管理系统,C/S结构,数据库是access2003.
上传时间: 2016-02-25
上传用户:牛津鞋
一本关于VC++的经典书,详细讲解了C++的设计模式,值得大家一看。
标签: VC
上传时间: 2013-12-17
上传用户:zhangjinzj
turbo码simulink编码程序,可以用来学如何用c++编写s函数。
上传时间: 2016-03-29
上传用户:baitouyu
用游标的方法实现对称差的计算,即 (A-B)+(B-A)
上传时间: 2016-05-23
上传用户:远远ssad
词法分析器 对输入一个函数,并对其分析main() { int a,b a = 10 b = a + 20 }
上传时间: 2013-12-20
上传用户:hfmm633
基因算法,用VC++或MATLAB,java等工具设计一程序计算任一个随机产生的DNA基因表达式的有效长度和值 设随机产生的基因表达式为: + Q - / b * b a Q b a a b a a b b a a a b
上传时间: 2014-01-09
上传用户:aa54
函数再现机构设计 试设计一曲柄摇杆机构,再现函数 要求: 输入构件的转角范围180°,输出构件摆角范围30°,即: 当输入构件从a转至a+90时,输出构件从b转至b+30 当输入构件从a+90转至a+180时,输出构件从b+30转至b
上传时间: 2013-12-17
上传用户:英雄