文件名称:verse K-th problem
介绍说明--下载内容来自于网络,使用问题请自行百度
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.)
第一行包含一个整数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
新建文件夹\verse K-th problem.cpp
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.