第一场 B Hints of sd0061
Posted Wally的博客
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了第一场 B Hints of sd0061相关的知识,希望对你有一定的参考价值。
There are nn noobs in the team, the ii-th of which has a rating aiai. sd0061 prepares one hint for each contest. The hint for the jj-th contest is a number bjbj, which means that the noob with the (bj+1)(bj+1)-th lowest rating is ordained by sd0061 for the jj-th contest.
The coach asks constroy to make a list of contestants. constroy looks into these hints and finds out: bi+bj≤bkbi+bj≤bk is satisfied if bi≠bj,bi≠bj, bi<bkbi<bk and bj<bkbj<bk.
Now, you are in charge of making the list for constroy.
InputThere are multiple test cases (about 1010).
For each test case:
The first line contains five integers n,m,A,B,Cn,m,A,B,C. (1≤n≤107,1≤m≤100)(1≤n≤107,1≤m≤100)
The second line contains mm integers, the ii-th of which is the number bibi of the ii-th hint. (0≤bi<n)(0≤bi<n)
The nn noobs‘ ratings are obtained by calling following function nn times, the ii-th result of which is aiai.
unsigned x = A, y = B, z = C;
unsigned rng61() {
unsigned t;
x ^= x << 16;
x ^= x >> 5;
x ^= x << 1;
t = x;
x = y;
y = z;
z = t ^ x ^ y;
return z;
}
OutputFor each test case, output " Case #xx: y1y1 y2y2 ?? ymym" in one line (without quotes), where xx indicates the case number starting from 11 and yiyi (1≤i≤m)(1≤i≤m) denotes the rating of noob for the ii-th contest of corresponding case.Sample Input
3 3 1 1 1 0 1 2 2 2 2 2 2 1 1
Sample Output
Case #1: 1 1 202755 Case #2: 405510 405510
题目大意:使用题目中给出的生成函数,生成n个数,然后给出m个bi打印n个数中第bi+1大的数。
解题思路:对bi进行由小到大排序,然后从m到0使用nth_element进行查找,找出bi+1大的数
AC代码:
以上是关于第一场 B Hints of sd0061的主要内容,如果未能解决你的问题,请参考以下文章
hdu 6040 -Hints of sd0061(STL)
HDU 6040 Hints of sd0061 nth_element函数
HDU 6040 Hints of sd0061 —— 2017 Multi-University Training 1
HDU 6040 Hints of sd0061(nth_element)
第十二届蓝桥杯省赛第一场C++ A/B/C组 真题题解(详细讲解 + 代码分析)看这篇就够了~~~~
Gym.102059: 2018-2019 XIX Open Cup, Grand Prix of Korea(寒假gym自训第一场)