题目描述
The most dangerous cyborg Jenish is finally entrapped on a narrow bridge over a valley. The bridge is $N$ meters long. For convenience, position $i$ represents a portion of bridge between whose left border is at distance $i-1$ meters from left end and right border is at distance $i$ meters from left end.
There are $N$ batteries placed at positions $1,2...N$. The $i^{th}$ one has energy $a[i]$.
There are two tanks of strength $X$ at positions $0$ and $N+1$. Initially Jenish has $0$ energy.
From now at any second $t$ starting from $1$,
first, Jenish can select any battery placed at position $i$ such that $(t \leq i \leq N-t+1)$ and add $a[i]$ to his energy (every battery can be used atmost once).
Then both the tanks move one meter towards each other. If there are still any batteries present at positions where the tanks are heading, the battery gets destroyed.
At any moment if Jenish's total energy is greater than or equal to $X$, he destroys both the tanks and he escapes the cops. If by the end of $\lfloor \frac {(n+1)}{2}\rfloor^{th}$ second, he can't destroy the tanks, he himself gets destroyed. Find out if he can escape.
-----Input:-----
- The first line consists of a single integer $T$, the number of test cases.
- The first line of each test case contains two space separated integers which represents $N$ and $X$ for that test case respectively.
- The second line of each test case contains $N$ space separated integers, $i^{th}$ of which represents $a[i]$.
-----Output:-----
For each test case, print in a single line, $YES$ if Jenish can escape or $NO$ if he gets destroyed.
-----Constraints:-----
- $1 \leq X \leq 10^9$
- $0 \leq a[i] \leq 10^6$
- $1 \leq N \leq 10^5$
- $\Sigma$ $N$ over all the test cases does not exceed $10^5$
-----Sample Input:-----
3
4 8
5 1 4 2
3 4
3 1 2
2 7
5 5
-----Sample Output:-----
YES
YES
NO
-----Explanation-----
For test $1$, in the 1st second, first Jenish will select battery at index $1$ and then the tanks from either side will move one meter closer, thus destroying the battery at index $4$.Then, in the next second, Jenish will select battery at index $3$.Then,tanks will move one meter closer again to destroy the remaining battery at index $2$.But now, Jenish has a total energy of $9$ units which is more than enough to destroy the tanks.
For test $2$, Jenish can use batteries at index $1$ and $2$ to get a total energy of $4$ units.
For test $3$, Jenish can use batteries at index $1$ or $2$ and get a maximum of $5$ units of energy which is less than required.
输入格式
见题面
输出格式
见题面