文件名称:verse K-th problem

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

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

FancyCoder提出了一个叫做“反向第K个问题”的问题。描述也很简单:给定一个数组包含N个整数A [1],A [2],...,A [n]和一些查询的数组,每次查询要求找出符合第K大的数是X的连续子序列的数目。
第一行包含一个整数T(1 <= T <= 5),表示测试用例数。
对于每个测试用例:第一行包含两个整数N和Q(1 <= N <= 2,000,1 <= Q <= 2,000,000),表示阵列中有N个整数,Q次查询。
第二行包含1和N之间的N个整数,表示数组的元素。
然后按照Q行,第i行包含两个整数Ki和Xi(1 <= Ki,Xi <= N),表示第i个查询要求数组的连续子序列数,其中第K大的元素是X。(FancyCoder raises problem called "Reverse K-th Problem". The descr iption is also simple: given an array of N integers A[1],A[2],...,A[n] and some queries, each query asks for the number of continuous subsequences of the array in which the K-th largest element is X.
The first line contains an integer T (1 <= T <= 5), indicating the number of test cases.
For each test case:
The first line contains two integers N and Q (1 <= N <= 2,000, 1 <= Q <= 2,000,000), indicating there are N integers in the array and Q queries.
The second line contains N integers between 1 and N, indicating the element of the array.
Then Q lines follow, the i-th line contains two integers Ki and Xi (1 <= Ki,Xi <= N), indicating that the i-th query asks for the number of continuous subsequences of the array in which the Ki-th largest element is Xi.
For each test case:
Output Q lines, the i-th line contains one integer, indicating the answer to the i-th query.)
相关搜索: poj

(系统自动生成,下载前可以参看下载内容)

下载文件列表

新建文件夹\2015级第5组_《计算机高级语言》 课程设计报告.doc

新建文件夹\verse K-th problem.cpp

相关说明

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

相关评论

暂无评论内容.

发表评论

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

源码中国 www.ymcn.org