Hints of sd0061

TimeLimit:2500MS  MemoryLimit:131072KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
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 m coming contests. sd0061 has left a set of hints for them.

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

The coach asks constroy to make a list of contestants. constroy looks into these hints and finds out: bi+bjbk is satisfied if bibj, bi<bk and bj<bk.

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

Input

There are multiple test cases (about 10).

For each test case:

The first line contains five integers n,m,A,B,C. (1n107,1m100)

The second line contains m integers, the i-th of which is the number bi of the i-th hint. (0bi<n)

The n noobs' ratings are obtained by calling following function n times, the i-th result of which is ai.

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 #x: y1 y2 ym" in one line (without quotes), where x indicates the case number starting from 1 and yi (1im) denotes the rating of noob for the i-th contest of corresponding case.

SampleInput
3 3 1 1 1
0 1 2
2 2 2 2 2
1 1
SampleOutput
Case #1: 1 1 202755
Case #2: 405510 405510
Submit
题目统计信息详细
总AC数33
通过人数29
尝试人数33
总提交量124
AC率23.39%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: