#P1209. The kth great number

The kth great number

题目描述

Xiao Ming and Xiao Bao are playing a simple Numbers game. In a round Xiao Ming can choose to write down a number, or ask Xiao Bao what the kth great number is. Because the number written by Xiao Ming is too much, Xiao Bao is feeling giddy. Now, try to help Xiao Bao.

翻译:给你一堆数你告诉我第K大的数就行了

输入格式

The first line of input contains two positive integer n, k. Then n lines follow. If Xiao Ming choose to write down a number, there will be an " I" followed by a number that Xiao Ming will write down. If Xiao Ming choose to ask Xiao Bao, there will be a "Q", then you need to output the kth great number. Xiao Ming won't ask Xiao Bao the kth great number when the number of the written number is smaller than k.

翻译:第一行两个数n,k(1<=k<=n<=1000000).,接下来n行每行一个操作,如果是'I'表示插入一个数,如果是'Q'表示询问第k大的数。

保证数据合法就是当前数量比k小时不会询问。

输出格式

The output consists of one integer representing the largest number of islands that all lie on one line.

翻译:每次询问输出第K大的数,每次输出占一行

样例

8 3
I 1
I 2
I 3
Q
I 5
Q
I 4
Q
1
2
3

Limitation

1s, 1024KiB for each test case.