← Home
write a go solution for Description:
There is an infinite 2-dimensional grid. Initially, a robot stands in the point (0,0). The robot can execute four commands:

- U — move from point (x,y) to (x,y+1);
- D — move from point (x,y) to (x,y-1);
- L — move from point (x,y) to (x-1,y);
- R — move from point (x,y) to (x+1,y).

You are given a sequence of commands s of length n. Your task is to answer q independent queries: given four integers x, y, l and r; determine whether the robot visits the point (x,y), while executing a sequence s, but the substring from l to r is reversed (i. e. the robot performs commands in order s_1s_2s_3...s_l-1s_rs_r-1s_r-2...s_ls_r+1s_r+2...s_n).

Input Format:
The first line contains two integers n and q (1<=n,q<=2*10^5) — the length of the command sequence and the number of queries, respectively.

The second line contains a string s of length n, consisting of characters U, D, L and/or R.

Then q lines follow, the i-th of them contains four integers x_i, y_i, l_i and r_i (-n<=x_i,y_i<=n; 1<=l<=r<=n) describing the i-th query.

Output Format:
For each query, print YES if the robot visits the point (x,y), while executing a sequence s, but the substring from l to r is reversed; otherwise print NO.

Note:
In the first query of the first sample, the path of the robot looks as follows:

In the second query of the first sample, the path of the robot looks as follows:

In the third query of the first sample, the path of the robot looks as follows:. Output only the code with no comments, explanation, or additional text.