Logo
(追記) (追記ここまで)

6806번 - Wowow 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB72201930.645%

문제

In the World of World of Warcraft, there is a very competitive ladder system. Sometimes players will change their rating. Also, new players (including more and more of your friends!) are constantly joining the game.

You and your group of friends would like to maintain a simple database with your scores, and you, as the computer scientist of the group, have been charged with the responsability of maintaning it. Don’t let your friends down!

입력

The input will consist of an integer N (1 ≤ N ≤ 1, 000, 000), followed by N lines. Each of these N lines will correspond to one of the following three formats:

  • N X R, where N is the character ’N’ to indicate a new friend has been added, X is a number (1 ≤ X ≤ 1, 000, 000) identifying this new friend, and R (1 ≤ R ≤ 108) is the rating of this new friend.
  • M X R, where M is the character ’M’ to indicate a modification of an existing friend, X is a number (1 ≤ X ≤ 1, 000, 000) identifying one of your friends, and R is the new rating assigned to this existing friend.
  • Q K, where Q is the character ’Q’ to represent a query, K is a number (1 ≤ K ≤ 1, 000, 000), and K is at most the number of your friends that have a rating at this point.

You may assume there will be no identical ratings in the input.

출력

For each line of input of the format Q K, you will output a line containing the identifier of the Kth highest rated person in the database at that point. Note that when K = 1, that is the top rated person, and K = 2 is the second best rated person, and so on.

제한

예제 입력 1

7
N 10 1000
N 3 1014
Q 1
M 10 2000
Q 1
N 65 1950
Q 2

예제 출력 1

3
10
65

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2010 > CCO 2010 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /