|
||||||||||
Negative and Positive (NP)Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 4518 Accepted Submission(s): 1219 Problem Description When given an array $\left( {{a_0},{a_1},{a_2}, \cdots {a_{n - 1}}} \right)$ and an integer $K$, you are expected to judge whether there is a pair $(i,j) (0 \leq i \leq j < n)$ which makes that $NP-sum(i,j)$ equals to $K$ true. Here $NP-sum(i,j)={a_i}{\rm{ - }}{a_{i{\rm{ + 1}}}}{\rm{ + }}{a_{i{\rm{ + }}2}}{\rm{ + }} \cdots {\rm{ + ( - 1}}{{\rm{)}}^{j - i}}{a_j}$ Input Multi test cases. In the first line of the input file there is an integer $T$ indicates the number of test cases. In the next $2*T$ lines, it will list the data for each test case. Each case occupies two lines, the first line contain two integers $n$ and $K$ which are mentioned above. The second line contain $\left( {{a_0},{a_1},{a_2}, \cdots {a_{n - 1}}} \right)$separated by exact one space. [Technical Specification] All input items are integers. $0 < T \leq 25,1 \leq n \leq 1000000,-1000000000 \leq ai \leq 1000000000,-1000000000 \leq K \leq 1000000000$ Output For each case£¬the output should occupies exactly one line. The output format is Case #id: ans, here id is the data number starting from 1; ans is ¡°Yes.¡± or ¡°No.¡± (without quote) according to whether you can find $(i,j)$ which makes $PN-sum(i,j)$ equals to $K$. See the sample for more details. Sample Input
Sample Output
Hint If input is huge, fast IO method is recommended. Source | ||||||||||
|