| Cupertino Informatics Tournament |
|---|
| Finished |
Trotles gave Keys and array with $$$n$$$ integers. However since Keys is very clumsy, he spilled juice over some values of the array. So now, for some of the values of array, Keys only knows a interval of values that it could be.
Given $$$q$$$ queries, where each query gives you a left and right endpoint of a range and a target sum, determine whether Keys can choose a value for each of the uncertain intervals such that the sum of the segment denoted by the left and right endpoints achieve the target sum.
The first line contains $$$n$$$ and $$$q$$$, the length of the array and the number of queries respectively. $$$1 \le n, q \le 10^5$$$.
The next $$$n$$$ lines contain either:
a) $$$1$$$ $$$a$$$ indicating that Keys knows this value of the array and it is equal to $$$a$$$. $$$1 \le a \le 1000$$$
b) $$$2$$$ $$$l$$$ $$$r$$$ indicating that Keys doesn't know this value and it could be anywhere from $$$l$$$ to $$$r$$$ inclusive. $$$1 \le l, r \le 1000$$$
The next $$$q$$$ lines contain 3 space separated numbers, $$$l$$$ $$$r$$$ $$$x$$$, the left endpoint, right endpoint, and target sum respectively. $$$1 \le l, r \le n$$$, $$$1 \le x \le 1000$$$
The output contains $$$q$$$ lines. Each line should contain "yes" if it is possible to choose values of the intervals to reach the target sum or "no" if it is not (without the quotes). It is case insensitive.
10 8 2 4 266 2 5 401 1 202 2 4 101 2 3 179 2 6 210 2 3 373 1 312 2 8 463 1 447 5 9 374 1 4 139 3 6 160 3 5 81 9 10 433 6 6 367 2 10 270 2 3 197
yes no no no no no no no
| Name |
|---|


