#P7441. [2017年杭电多校]Hints of sd0061

    ID: 7454 传统题 1000ms 256MiB 尝试: 4 已通过: 1 难度: 5 上传者: 标签>CF1800普及+/提高-快速选择查询排序

[2017年杭电多校]Hints of sd0061

Hints of sd0061

Problem Description

sd0061 , the legend of Beihang University ACM-ICPC Team, retired last year leaving a group of noobs. Noobs have no idea how to deal with mm coming contests. sd0061 has left a set of hints for them. There are nn noobs in the team, the ii-th of which has a rating aia_i. sd0061 prepares one hint for each contest. The hint for the jj-th contest is a number bjb_j, which means that the noob with the (bj+1)(b_j + 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≤bkb_i + b_j \leq b_k is satisfied if bi≠bj,b_i \neq b_j, bi<bkb_i < b_k and bj<bkb_j < b_k. Now, you are in charge of making the list for constroy .

Input

There 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 \leq n \leq 10^7, 1 \leq m \leq 100) The second line contains mm integers, the ii-th of which is the number bib_i of the ii-th hint. (0≤bi<n)(0 \leq b_i < n) The nn noobs' ratings are obtained by calling following function nn times, the ii-th result of which is aia_i. 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; }

Output

For each test case, output " Case #xx: y1y_1 y2y_2 ⋯\cdots ymy_m " in one line (without quotes), where xx indicates the case number starting from 11 and yiy_i (1≤i≤m)(1 \leq i \leq 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

Source

2017 Multi-University Training Contest - Team 1