文件名称:4

  • 所属分类:
  • 数据结构常用算法
  • 资源属性:
  • [C/C++] [源码]
  • 上传时间:
  • 2016-11-20
  • 文件大小:
  • 1kb
  • 下载次数:
  • 0次
  • 提 供 者:
  • 邓**
  • 相关连接:
  • 下载说明:
  • 别用迅雷下载,失败请重下,重下不扣分!

介绍说明--下载内容均来自于网络,请自行研究使用

本题关于排序与细节处理,故选择int数组作为数据结构。

  算法思想如下:对于输入的数据,根据其后的‘+’‘-’,用a,b的数组分别记录染病和正常的动物的高度。然后分别将a,b两数组排序。对于其后的m组询问,分别求出要杀中的动物数量x和最多误杀的动物数量y,分别询问a,b数组的倒数x,y位置的元素,稍作处理,分别作为最高高度和最低高度输出(若不和逻辑,输出-1)。程序结束。

  复杂度:本题的运算时间主要用于排序(快排),故复杂度为O(nlogn)。空间复杂度是 O(n)。

-This question on the sort and details of the deal, it is selected int array as a data structure.

Algorithm for the following ideas: For the input data, according to the subsequent +  - , with a, b, respectively, the array of infected and normal animal height. Then a, b, respectively, the two array sort. For the subsequent group m queries, respectively, to determine the number of animals to kill x and the number of animals manslaughter y, were asked a, b array of reciprocal x, y position of the element, a little processing, respectively, as the maximum height and The minimum height output (if not and logic, outputs-1). The program ends.

Complexity: The computation time of this problem is mainly used for sorting (fast row), so the complexity is O (nlogn). The spatial complexity is O (n).
(系统自动生成,下载前可以参看下载内容)

下载文件列表





4.cpp

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度更多...
  • 请直接用浏览器下载本站内容,不要使用迅雷之类的下载软件,用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.

相关评论

暂无评论内容.

发表评论

*主  题:
*内  容:
*验 证 码:

源码中国 www.ymcn.org