{"raw_statement":[{"iden":"statement","content":"Vladik had started reading a complicated book about algorithms containing _n_ pages. To improve understanding of what is written, his friends advised him to read pages in some order given by permutation _P_ = \\[_p_1, _p_2, ..., _p__n_\\], where _p__i_ denotes the number of page that should be read _i_\\-th in turn.\n\nSometimes Vladik’s mom sorted some subsegment of permutation _P_ from position _l_ to position _r_ inclusive, because she loves the order. For every of such sorting Vladik knows number _x_ — what index of page in permutation he should read. He is wondered if the page, which he will read after sorting, has changed. In other words, has _p__x_ changed? After every sorting Vladik return permutation to initial state, so you can assume that each sorting is independent from each other."},{"iden":"input","content":"First line contains two space-separated integers _n_, _m_ (1 ≤ _n_, _m_ ≤ 104) — length of permutation and number of times Vladik's mom sorted some subsegment of the book.\n\nSecond line contains _n_ space-separated integers _p_1, _p_2, ..., _p__n_ (1 ≤ _p__i_ ≤ _n_) — permutation _P_. Note that elements in permutation are distinct.\n\nEach of the next _m_ lines contains three space-separated integers _l__i_, _r__i_, _x__i_ (1 ≤ _l__i_ ≤ _x__i_ ≤ _r__i_ ≤ _n_) — left and right borders of sorted subsegment in _i_\\-th sorting and position that is interesting to Vladik."},{"iden":"output","content":"For each mom’s sorting on it’s own line print \"_Yes_\", if page which is interesting to Vladik hasn't changed, or \"_No_\" otherwise."},{"iden":"examples","content":"Input\n\n5 5\n5 4 3 2 1\n1 5 3\n1 3 1\n2 4 3\n4 4 4\n2 5 3\n\nOutput\n\nYes\nNo\nYes\nYes\nNo\n\nInput\n\n6 5\n1 4 3 2 5 6\n2 4 3\n1 6 2\n4 5 4\n1 3 3\n2 6 3\n\nOutput\n\nYes\nNo\nYes\nNo\nYes"},{"iden":"note","content":"Explanation of first test case:\n\n1.  \\[1, 2, 3, 4, 5\\] — permutation after sorting, 3\\-rd element hasn’t changed, so answer is \"_Yes_\".\n2.  \\[3, 4, 5, 2, 1\\] — permutation after sorting, 1\\-st element has changed, so answer is \"_No_\".\n3.  \\[5, 2, 3, 4, 1\\] — permutation after sorting, 3\\-rd element hasn’t changed, so answer is \"_Yes_\".\n4.  \\[5, 4, 3, 2, 1\\] — permutation after sorting, 4\\-th element hasn’t changed, so answer is \"_Yes_\".\n5.  \\[5, 1, 2, 3, 4\\] — permutation after sorting, 3\\-rd element has changed, so answer is \"_No_\"."}],"translated_statement":[{"iden":"statement","content":"Vladik 开始阅读一本包含 $n$ 页的复杂算法书。为了更好地理解内容，他的朋友们建议他按照排列 $P = [p_1, p_2, \\dots, p_n]$ 的顺序阅读页面，其中 $p_i$ 表示第 $i$ 个阅读的页面编号。\n\n有时，Vladik 的妈妈会将排列 $P$ 中从位置 $l$ 到位置 $r$（包含）的子段进行排序，因为她喜欢有序。对于每一次这样的排序，Vladik 知道一个数 $x$ —— 他需要阅读的页面在排列中的索引。他想知道，经过排序后，他要阅读的页面是否发生了变化。换句话说，$p_x$ 是否发生了变化？每次排序后，Vladik 都会将排列恢复为初始状态，因此你可以假设每次排序是相互独立的。\n\n第一行包含两个用空格分隔的整数 $n$, $m$ ($1 \\leq n, m \\leq 10^4$) —— 排列的长度和 Vladik 的妈妈对书的子段进行排序的次数。\n\n第二行包含 $n$ 个用空格分隔的整数 $p_1, p_2, \\dots, p_n$ ($1 \\leq p_i \\leq n$) —— 排列 $P$。注意排列中的元素互不相同。\n\n接下来的 $m$ 行中，每行包含三个用空格分隔的整数 $l_i$, $r_i$, $x_i$ ($1 \\leq l_i \\leq x_i \\leq r_i \\leq n$) —— 第 $i$ 次排序的子段左右边界和 Vladik 感兴趣的位置。\n\n对于每次妈妈的排序，请在单独的一行输出 \"_Yes_\"，如果 Vladik 感兴趣的页面没有变化；否则输出 \"_No_\"。\n\n第一个测试用例的解释：\n\n"},{"iden":"input","content":"第一行包含两个用空格分隔的整数 $n$, $m$ ($1 \\leq n, m \\leq 10^4$) —— 排列的长度和 Vladik 的妈妈对书的子段进行排序的次数。第二行包含 $n$ 个用空格分隔的整数 $p_1, p_2, \\dots, p_n$ ($1 \\leq p_i \\leq n$) —— 排列 $P$。注意排列中的元素互不相同。每行接下来的 $m$ 行包含三个用空格分隔的整数 $l_i$, $r_i$, $x_i$ ($1 \\leq l_i \\leq x_i \\leq r_i \\leq n$) —— 第 $i$ 次排序的子段左右边界和 Vladik 感兴趣的位置。"},{"iden":"output","content":"对于每次妈妈的排序，请在单独的一行输出 \"_Yes_\"，如果 Vladik 感兴趣的页面没有变化；否则输出 \"_No_\"。"},{"iden":"examples","content":"输入\n5 5\n5 4 3 2 1\n1 5 3\n1 3 1\n2 4 3\n4 4 4\n2 5 3\n输出\nYes\nNo\nYes\nYes\nNo\n\n输入\n6 5\n1 4 3 2 5 6\n2 4 3\n1 6 2\n4 5 4\n1 3 3\n2 6 3\n输出\nYes\nNo\nYes\nNo\nYes"},{"iden":"note","content":"第一个测试用例的解释：\n\n$[1, 2, 3, 4, 5]$ —— 排序后的排列，第 $3$ 个元素没有变化，因此答案为 \"_Yes_\"。\n\n$[3, 4, 5, 2, 1]$ —— 排序后的排列，第 $1$ 个元素发生了变化，因此答案为 \"_No_\"。\n\n$[5, 2, 3, 4, 1]$ —— 排序后的排列，第 $3$ 个元素没有变化，因此答案为 \"_Yes_\"。\n\n$[5, 4, 3, 2, 1]$ —— 排序后的排列，第 $4$ 个元素没有变化，因此答案为 \"_Yes_\"。\n\n$[5, 1, 2, 3, 4]$ —— 排序后的排列，第 $3$ 个元素发生了变化，因此答案为 \"_No_\"。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions:**\n\n- Let $ P = [p_1, p_2, \\dots, p_n] $ be a permutation of $ \\{1, 2, \\dots, n\\} $.\n- For each query $ i $, given $ (l_i, r_i, x_i) $, let $ Q $ be the permutation obtained by sorting the subsegment $ P[l_i:r_i] $ (inclusive) in non-decreasing order, while leaving the rest of $ P $ unchanged.\n\n**Given:**\n\n- $ n, m \\in \\mathbb{N} $, $ 1 \\leq n, m \\leq 10^4 $\n- $ P \\in S_n $, a permutation of $ \\{1, 2, \\dots, n\\} $\n- $ m $ queries, each of the form $ (l, r, x) $, with $ 1 \\leq l \\leq x \\leq r \\leq n $\n\n**Objective:**\n\nFor each query $ (l, r, x) $, determine whether $ p_x $ remains at position $ x $ after sorting the subsegment $ P[l:r] $.\n\nThat is, let $ P' $ be the permutation where:\n- $ P'[j] = P[j] $ for $ j \\notin [l, r] $\n- $ P'[l:r] $ is the sorted (ascending) version of $ P[l:r] $\n\nThen output:\n- \"Yes\" if $ P'[x] = P[x] $\n- \"No\" otherwise\n\n**Equivalent Condition:**\n\nLet $ S = \\{ p_j \\mid l \\leq j \\leq r \\} $ be the multiset of values in the subsegment.\n\nLet $ k $ be the number of elements in $ S $ that are **strictly less than** $ p_x $.\n\nThen $ P'[x] = P[x] $ **if and only if** the rank of $ p_x $ within $ S $ (i.e., its position in the sorted version of $ S $) places it exactly at position $ x $ in the original array.\n\nMore precisely:  \nAfter sorting $ P[l:r] $, the element $ p_x $ will be placed at position $ l + k $ in the new array (since $ k $ smaller elements come before it).\n\nThus, $ P'[x] = P[x] $ **iff**  \n$$\nl + k = x\n$$\n\nWhere $ k = \\left| \\{ j \\in [l, r] \\mid p_j < p_x \\} \\right| $\n\n---\n\n**Final Formal Statement:**\n\nFor each query $ (l, r, x) $:\n\nLet $ k = \\#\\{ j \\in [l, r] \\mid p_j < p_x \\} $\n\nThen:\n$$\n\\text{Answer} = \n\\begin{cases}\n\\text{\"Yes\"} & \\text{if } l + k = x \\\\\n\\text{\"No\"} & \\text{otherwise}\n\\end{cases}\n$$","simple_statement":null,"has_page_source":false}