<PREV Problem:
NEXT>
Solved by 24 users: KZ, JohnJones_001, vi002, WsemirZ, Rizvanov, Norbert, Philip_PV, Agarb, defrager, UdH-WiNGeR, RAVEman, maciejk, DAV, Kuznetsov_S, kornakovBSU, abortmozga.ru, Dest, fetetriste, ripatti, ethanhunt, okoled, NIGHTFIT, steven, murphy.
UserDateAttemptTimeCMSC
Rizvanov19 jan 2009C++200.60617 
kornakovBSU22 jan 2010C++3003.72769 
kornakovBSU18 dec 2009C++2301.54866 
kornakovBSU02 may 2010C++3201.54869 
kornakovBSU15 dec 2009C++1701.51877 
Philip_PV11 feb 2009C++500.97920 
DAV01 sep 2009C++1603.53924 
DAV01 sep 2009C++1403.51926 
RAVEman09 mar 2009C++1300.67963 
steven29 jun 2012C++600.991048 
DAV04 sep 2009C++2103.331058 
fetetriste30 jan 2010Java101.781062 
DAV04 sep 2009C++1702.841064 
UdH-WiNGeR09 mar 2009Java101.641073 
ethanhunt07 jun 2011C++1200.761084 
RAVEman09 mar 2009C++600.631094 
NIGHTFIT05 apr 2012C++2100.841094 
ethanhunt07 jun 2011C++900.751097 
NIGHTFIT09 apr 2012C++2200.791097 
Languages
C++
21
Java
3
Kylix
1
FPC
1
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

Database Query Engine

Time limit = 4 second(s)

Memory limit = 64 Mb

Stock market securities have many properties such as floating price, volatility, liquidity, etc. Also one may estimate their mean profitability, growth potential, etc.

WebMarket is a managing company of a stock exchange. It provides trading facilities for stock brokers and traders, services for issue and redemption of securities as well as other financial instruments and capital events including payment of income and dividends.

WebMarket analysts introduce a new market index called reliability. High reliability value implies low risk of buy, but also lower profit estimate.

WebMarket analysts decide to make the reliability index public and provide a service of buying the security with the K-th highest value of reliability. According to WebMarket analysts this instrument will attract more clients and increase the market turnover.

Reliability estimation algorithms are already baked. Your task is to write a program that manipulates the reliability index list. The securities are listed in the decreasing order of reliability. The securities with equal reliabilities are listed in the increasing order of their ids.

Securities in the Webmarket database have three attributes:

For each new security, the value of id is automatically assigned to the next available id. Initial value of reliability is 0. If a security is removed its id is never reused.

The following requests should be supported: issuing a new security, removing a security from the database, changing the value of reliability for an existing security, and finding the K-th security in the reliability index list.

Output

The first line contains the number of requests N (0 ≤ N ≤ 100000). The next N lines contain requests, one per line. A request has one of the following four forms.

Your program should respond with one line for each request.

Input#1
17
ISSUE aaa
FIND 10
ISSUE bbb
ISSUE ccc
RELIABILITY aaa 10
RELIABILITY bbb 30
RELIABILITY ccc 20
RELIABILITY xxx 20
FIND 1
FIND 2
FIND 0
ISSUE eee
ISSUE fff
FIND 3
FIND 111
DELETE bbb
FIND 0
Output#1
CREATED 0 0
OK aaa 0 0
CREATED 1 0
CREATED 2 0
OK 0 10
OK 1 30
OK 2 20
BAD REQUEST
OK ccc 2 20
OK aaa 0 10
OK bbb 1 30
CREATED 3 0
CREATED 4 0
OK eee 3 0
OK fff 4 0
OK 1 30
OK ccc 2 20


Author:
ACM ICPC 2008-2009, Moscow Subregional Contest, Moscow, October 26, 2008.
Artem Voroztsov
26 October 2008

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 230ms

SW soft NIX
ID = 3.226.248.180