{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003cp\u003eThe \"I-Love-Kd-trees\u0027\u0027 annual con is receiving too many applicants so they decided to complicate a bit the task used to select participants. (They realized some people were using other data structures to solve their problems, so they designed this problem, almost only solvable with Kd-trees).\u003c/p\u003e\r\n\u003cp\u003eYou are given a list of \u003cstrong\u003eN\u003c/strong\u003e numbers and \u003cstrong\u003eQ\u003c/strong\u003e queries. Each query can be of two types.\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003cstrong\u003eType-0\u003c/strong\u003e queries (marked with 0 in the input), consist of three integers: \u003cstrong\u003ei,\u003c/strong\u003e \u003cstrong\u003el\u003c/strong\u003e and \u003cstrong\u003ek\u003c/strong\u003e ; let \u003cstrong\u003ed\u003c/strong\u003e be the \u003cstrong\u003ek-th\u003c/strong\u003e smallest element until the index \u003cstrong\u003ei\u003c/strong\u003e (i.e. if the first i +1 elements were sorted in non-descending way, \u003cstrong\u003ed\u003c/strong\u003e would be the element at index k - 1). Then, the answer to each query is the index of the \u003cstrong\u003el-th\u003c/strong\u003e occurrence of \u003cstrong\u003ed\u003c/strong\u003e in the array. If there\u0027s no such index, the answer is -1. \u003c/li\u003e\r\n\u003cli\u003e\u003cstrong\u003eType-1\u003c/strong\u003e queries (marked with 1 in the input) are contiguous-swap update-queries, and consists of a single integer \u003cstrong\u003ei\u003c/strong\u003e. When a type-1 query is executed the elements at index i and i +1 in the list must be swapped.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eYou have to consider that all indexes are counted starting with 0.\u003c/p\u003e\r\n\r\n\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003eInput consists of one test case.\u003c/p\u003e\r\n\u003cp\u003eThe first line contains two integers, \u003cstrong\u003eN\u003c/strong\u003e (1 ≤ N ≤ 10\u003csup\u003e6\u003c/sup\u003e) and \u003cstrong\u003eQ\u003c/strong\u003e (1 ≤ Q ≤ 10\u003csup\u003e5\u003c/sup\u003e).\u003c/p\u003e\r\n\u003cp\u003eThe next line contains \u003cstrong\u003eN\u003c/strong\u003e possible distinct integers \u003cstrong\u003ea\u003csub\u003ei\u003c/sub\u003e\u003c/strong\u003e (-10\u003csup\u003e9\u003c/sup\u003e ≤ ai ≤ 10\u003csup\u003e9\u003c/sup\u003e).\u003c/p\u003e\r\n\u003cp\u003eThen \u003cstrong\u003e Q\u003c/strong\u003e lines follow. Each of them starts with an integer which can be 0 or 1, denoting the type of the query. If it’s 0, then three integers \u003cstrong\u003ei\u003c/strong\u003e, \u003cstrong\u003el\u003c/strong\u003e and \u003cstrong\u003ek\u003c/strong\u003e follow (0 ≤ i \u0026lt; N, 1 ≤ k ≤ i+1, 1 ≤ l ≤ N).\u003c/p\u003e\r\n\u003cp\u003eIf it’s 1, then an integer \u003cstrong\u003ei\u003c/strong\u003e follows, meaning that you have to swap the elements at indexes i and i+1 (0 ≤ i ≤ N-1).\u003c/p\u003e\r\n\r\n\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003eFor each query of type-0 (in the same order as the input) output a single line with the answer to that query.\u003c/p\u003e\r\n\u003ch3\u003eExample\u003c/h3\u003e\r\n\u003cdiv\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e10 6\n2 3 1 1 2 7 9 1 2 6\n0 2 3 2\n1 1 \n1 2 \n0 2 3 2 \n1 0 \n0 0 2 1\n\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e8\n7\n2\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e"}}]}