406063: GYM102253 H Hints of sd0061

Memory Limit:128 MB Time Limit:3 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Hints of sd0061time limit per test3 secondsmemory limit per test128 megabytesinputstandard inputoutputstandard output

sd0061, a legend from Beihang University ACM-ICPC Team, retired last year leaving a group of noobs with no idea how to cope with $$$m$$$ upcoming contests. What sd0061 left for them is only a set of hints.

There are $$$n$$$ noobs in the team, the $$$i$$$-th of which has a rating, $$$a_i$$$. sd0061 prepared one hint for each contest. The hint for the $$$j$$$-th contest is a number, $$$b_j$$$, which means that the noob with the $$$(b_j + 1)$$$-th lowest rating is ordained by sd0061 to compete in the $$$j$$$-th contest.

The coach is going to ask constroy to list these contestants. Before that, constroy peeked these hints and found that $$$b_i + b_j \leq b_k$$$ if $$$b_i \neq b_j$$$, $$$b_i < b_k$$$, $$$b_j < b_k$$$.

Now, you are in charge of making the list for constroy.

Input

The input contains multiple (about $$$15$$$) test cases.

For each test case, the first line contains five integers $$$n$$$, $$$m$$$, $$$A$$$, $$$B$$$, $$$C$$$ ($$$1 \leq n \leq 10^7$$$, $$$1 \leq m \leq 100$$$, $$$0 \leq A, B, C < 2^{32}$$$).

The second line contains $$$m$$$ integers, the $$$i$$$-th number of which is $$$b_i$$$ ($$$0 \leq b_i < n$$$).

Ratings of these $$$n$$$ noobs are obtained by calling the following C/C++ function $$$n$$$ times, the $$$i$$$-th result of which is $$$a_i$$$.

unsigned x = A, y = B, z = C;
unsigned rng61() {
unsigned t;
x = x ^ (x << 16);
x = x ^ (x >> 5);
x = x ^ (x << 1);
t = x;
x = y;
y = z;
z = (t ^ x) ^ y;
return z;
}

In this function, unsigned means the unsigned $$$32$$$-bit integer type, and ^ means the bitwise XOR operator. Note any integer overflow may occur in the function should be ignored, and $$$x$$$, $$$y$$$, $$$z$$$ are reset to their initial values $$$A$$$, $$$B$$$, $$$C$$$ respectively at the beginning of each test case.

Output

For each test case, output "Case #x: y$$$_{1}$$$ y$$$_{2}$$$ $$$\ldots$$$ y$$$_{m}$$$" in one line (without quotes), where $$$x$$$ indicates the case number starting from $$$1$$$, and $$$y_i$$$ denotes the rating of the noob ordained for the $$$i$$$-th contest in the corresponding case.

ExampleInput
3 3 1 1 1
0 1 2
2 2 2 2 2
1 1
Output
Case #1: 1 1 202755
Case #2: 405510 405510

加入题单

算法标签: