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

建议使用的浏览器:

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

5579:Game of Arrays

题目描述
Tweek and Craig are good friends and always playing together. And they just invented a new game when doing their math homework.

First of all, they write three arrays $A$, $B$, and $C$, each with $N$ numbers. Then on the black board, they write those arrays as

$$A + B = C$$

If the equation is satisfied, it means for each position $i$ from $1$ to $N$, there are $A_i + B_i = C_i$ holds.

Of course, this equation is not always satisfied at the very beginning.

Fortunately, for arrays $A$, $B$ and $C$, some numbers are $changeable$, while other's are not. Those $changeable$ numbers' positions are determined before the game begins.

During the game, Tweek and Craig will take turns, trying to change a number from an array. Tweek plays first.

In each turn, the player can choose a $changeable$ number from an array, and substract it by one. However, no negative numbers should appear, so the chosen number cannot be $0$ before substraction.

Tweek's goal is to make the equation satisfied during the game, while Craig's goal is to prevent it to happen.

The game ends when the equation is satisfied (a win for Tweek) or there are no possible moves but still $A + B \neq C$ (means there is at least one $i \in \left[1, N\right]$, where $A_i + B_i \neq C_i$, which is a win for Craig).

Given $A$, $B$ and $C$, and the position of $changeable$ numbers for each array, your task is to determine the winner.
输入解释
First line contains an integer $T$, which indicates the number of test cases.

Every test case begins with an integers $N$, which is the length of array $A$, $B$ and $C$.

The $2^{nd}$ line and $3^{rd}$ line describe the array $A$. The $2^{nd}$ line contains $N$ intergers $A_1$, $A_2$, $\cdots$, $A_N$, indicating the elements in array $A$. The $3^{rd}$ line contains $N$ intergers $u_1$, $u_2$, $\cdots$, $u_N$, and $u_i$ is $1$ if $A_i$ is $changeable$, otherwise $u_i$ is $0$.

The $4^{th}$ line and $5^{th}$ line describe the array $B$. The $4^{th}$ line contains $N$ intergers $B_1$, $B_2$, $\cdots$, $B_N$, indicating the elements in array $B$. The $5^{th}$ line contains $N$ intergers $v_1$, $v_2$, $\cdots$, $v_N$, and $v_i$ is $1$ if $B_i$ is $changeable$,otherwise $v_i$ is $0$.

The $6^{th}$ line and $7^{th}$ line describe the array $C$. The $6^{th}$ line contains $N$ intergers $C_1$, $C_2$, $\cdots$, $C_N$, indicating the elements in array $C$. The $7^{th}$ line contains $N$ intergers $w_1$, $w_2$, $\cdots$, $w_N$, and $w_i$ is $1$ if $C_i$ is $changeable$,otherwise $w_i$ is $0$.

$\cdot$ $1 \leq T \leq 2000$.

$\cdot$ for 75% data, $1 \leq N \leq 10$.

$\cdot$ for 95% data, $1 \leq N \leq 50$.

$\cdot$ for 100% data, $1 \leq N \leq 100$.

$\cdot$ $0 \leq A_i, B_i, C_i \leq 10^9$.

$\cdot$ both $u_i, v_i, w_i$ is either $0$ or $1$.
输出解释
For every test case, you should output "Case #x: y", where $x$ indicates the case number and counts from $1$, and $y$ is the winner of the game.
输入样例
3
2
4 3
1 1
4 4
0 1
5 5
0 0
2
4 4
1 1
4 4
0 0
5 5
0 0
2
4 4
1 1
4 4
0 0
4 4
0 0
输出样例
Case #1: Tweek
Case #2: Craig
Case #3: Tweek
来自杭电HDUOJ的附加信息
Recommend wange2014

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

源链接: HDU-5579

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

共提交 0

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