{"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\u003e \u003c/p\u003e\r\n\u003ctable class\u003d\"problems\" style\u003d\"width: 100%;\" border\u003d\"0\"\u003e\r\n\u003ctbody\u003e\r\n\u003ctr class\u003d\"navigation\"\u003e\r\n\u003ctd width\u003d\"50%\"\u003e\u003ca href\u003d\"https://www.spoj.com/problems/ORDERSET/en/\"\u003eEnglish\u003c/a\u003e\u003c/td\u003e\r\n\u003ctd width\u003d\"50%\"\u003e\u003ca href\u003d\"https://www.spoj.com/problems/ORDERSET/vn/\"\u003eVietnamese\u003c/a\u003e\u003c/td\u003e\r\n\u003c/tr\u003e\r\n\u003c/tbody\u003e\r\n\u003c/table\u003e\r\n\u003cp\u003e\u003c/p\u003e\r\n\u003cp\u003eIn this problem, you have to maintain a dynamic set of numbers which support the two fundamental operations\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eINSERT(S,x): if x is not in S, insert x into S\u003c/li\u003e\r\n\u003cli\u003eDELETE(S,x): if x is in S, delete x from S\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eand the two type of queries\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eK-TH(S) : return the k-th smallest element of S\u003c/li\u003e\r\n\u003cli\u003eCOUNT(S,x): return the number of elements of S smaller than x\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eLine 1: Q (1 ≤ Q ≤ 200000), the number of operations\u003c/li\u003e\r\n\u003cli\u003eIn the next Q lines, the first token of each line is a character I, D, K or C meaning that the corresponding operation is INSERT, DELETE, K-TH or COUNT, respectively, following by a whitespace and an integer which is the parameter for that operation.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eIf the parameter is a value x, it is guaranteed that 0 ≤ |x| ≤ 10\u003csup\u003e9\u003c/sup\u003e. If the parameter is an index k, it is guaranteed that 1 ≤ k ≤ 10\u003csup\u003e9\u003c/sup\u003e.\u003c/p\u003e\r\n\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003eFor each query, print the corresponding result in a single line. In particular, for the queries K-TH, if k is larger than the number of elements in S, print the word \u0027invalid\u0027.\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\u003e8\r\nI -1\r\nI -1\r\nI 2\r\nC 0\r\nK 2\r\nD -1\r\nK 1\r\nK 2\r\n\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n2\r\n2\r\ninvalid\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\r\n\u003cp\u003e \u003c/p\u003e\n\u003c/div\u003e"}}]}