当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6655:Just Repeat

题目描述
When Cuber QQ was chatting happily in a QQ group one day, he accidentally noticed that there was a counterfeit of him, who stole his avatar and mimicked his tone, and more excessively, had a nickname "Quber CC", which was sarcastic to him. So Cuber QQ decided to play a little game with this Quber CC, and their bet was, whoever lost the game would have to do something really humiliating in front of everyone in the QQ group.

The game is like this. It's a traditional card game. Cuber QQ will play first. Cuber QQ, and his opponent (Quber CC of course), will each possess a hand of cards. There is no number (or rank if you prefer) on the card, but only color (or suit if you prefer). The players play cards alternatively, each player can only play one card in each turn. An additional rule is that, a player must not play a card with the same color as any card which has been played by his/her opponent, but coincidence with a card played by himself/herself is acceptable.

The player who can't play any card loses. This might due to the fact that he/she has cards but he cannot play any due to the game rules, or he doesn't have any cards any more. As a game played between civilized people, the game will be played in a completely transparent manner, where Cuber QQ and Quber CC know exactly what's left in their opponent's hand.

It's now a game attracting thousands of eyes, and you decided to invent a predictor whose job is to predict "who will win if both players play smart" to excite the audience.
输入解释
The first line of the input is a positive integer $t$, denoting the number of test cases.

Then follows $t$ test cases, each test case starts with space-separated integers $n$, $m$, $p$ ($1 \le n, m \le 10^5$, $p \in \{1, 2\}$). Generally speaking, this should be followed by two lines of integers $a_1, a_2, \ldots, a_n$ and $b_1, b_2, \ldots, b_m$, denoting the colors of Cuber QQ's hand and Quber CC's hand, respectively. Unfortunately, as it turns out, the input will be the bottleneck in that case. So we introduce $p$ to deal with this problem.

For $p = 1$, there follows two lines, where the first line is $a_1, a_2, \ldots, a_n$ and the second line is $b_1, b_2, \ldots, b_m$, all space separated and $0 \le a_i, b_i < 10^9$.

For $p = 2$, there follows two lines, which are $k_1, k_2, mod$ ($0 \le k_1, k_2 < 2^{64}$, $1 \le mod \le 10^9$) to generate $\{a_i\}$ and $\{b_i\}$, respectively.

Here are some instructions on how to generate $\{a_i\}$, $\{b_i\}$ with $k_1, k_2, mod$, which you've probably seen before, somehow:


unsigned long long k1, k2;
unsigned long long rng() {
unsigned long long k3 = k1, k4 = k2;
k1 = k4;
k3 ^= k3 << 23;
k2 = k3 ^ k4 ^ (k3 >> 17) ^ (k4 >> 26);
return k2 + k4;
}

// generate
read(k1, k2, mod);
for (int i = 0; i < n; ++i)
a[i] = rng() % mod;

read(k1, k2, mod);
for (int i = 0; i < m; ++i)
b[i] = rng() % mod;


Also, the sum of $n+m$ for $p=1$ does not exceed $5 \cdot 10^5$; the sum of $n+m$ from all test cases does not exceed $10^7$.
输出解释
For each test case, predict the winner: "Cuber QQ" or "Quber CC".
输入样例
2
6 7 1
1 1 4 5 1 4
1 9 1 9 8 1 0
10 20 2
1 2 10
1 2 10
输出样例
Cuber QQ
Quber CC
来自杭电HDUOJ的附加信息
Recommend chendu

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6655

最后修改于 2020-10-25T23:33:13+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000/2000MS(Java/Others) 524288/524288K(Java/Others)