{"trustable":false,"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":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e\n \u003cdiv id\u003d\"problem-body\"\u003e \n \u003cp\u003eIn this problem, you have to maintain a dynamic set of numbers which support the two fundamental operations\u003c/p\u003e \n \u003cul\u003e \n \u003cli\u003eINSERT(S,x): if x is not in S, insert x into S\u003c/li\u003e \n \u003cli\u003eDELETE(S,x): if x is in S, delete x from S\u003c/li\u003e \n \u003c/ul\u003e \n \u003cp\u003eand the two type of queries\u003c/p\u003e \n \u003cul\u003e \n \u003cli\u003eK-TH(S) : return the k-th smallest element of S\u003c/li\u003e \n \u003cli\u003eCOUNT(S,x): return the number of elements of S smaller than x\u003c/li\u003e \n \u003c/ul\u003e \n \u003ch3\u003eInput\u003c/h3\u003e \n \u003cul\u003e \n \u003cli\u003eLine 1: Q (1 ≤ Q ≤ 200000), the number of operations\u003c/li\u003e \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 \n \u003c/ul\u003e \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 \n \u003ch3\u003eOutput\u003c/h3\u003e \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 \n \u003ch3\u003eExample\u003c/h3\u003e \n \u003cpre\u003e\u003cstrong\u003eInput\u003c/strong\u003e\n8\nI -1\nI -1\nI 2\nC 0\nK 2\nD -1\nK 1\nK 2\n\n\u003cstrong\u003eOutput\u003c/strong\u003e\n1\n2\n2\ninvalid\n\u003c/pre\u003e \n \u003c/div\u003e\n \u003c/body\u003e\n\u003c/html\u003e"}}]}