Bot of Rancho
All submissions for this problem are available.
Rancho is designing a surveillance bot which has the capability to remember the coordinates of the given points and reply for the queries when asked.
The bot is placed at (0,0) with x axis towards right and y axis towards up.
It has the capability to add, erase and get a point in the system :
add a b : Bot places a marker at the point (a,b). If the point is previously marked then ignores it.
erase a b : Bot deletes the marker from the (a,b).It will be made sure that the point (a,b) contains a marker at the time of this query.
get a b : The bot finds all the markers which are strictly up and strictly right of (a,b) and returns the leftmost one.In case there are more than one such markers then it returns the bottom-most one.
Now its time to test the Bot.Given the queries, give the output returned by the Bot.
First Line contains N : Number of requests
followed by N lines containing the queries of the form of add/erase/get a b as defined earlier.
For each request of type ‘get a b‘ output ‘X Y’ : coordinates of the bottommost among the leftmost markers, lying strictly above and to the right of point (a,b). If there are no such points , output -1.
- 1 ≤ N ≤ 100000
- 0 ≤ a , b ≤ 10^9
- a,b and N are integers
Input: 10 add 1 2 add 2 4 add 1 1 add 2 4 erase 1 2 get 0 0 get 5 5 get 1 1 add 6 6 get 5 5 Output: 1 1 -1 2 4 6 6
|Time Limit:||0.1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions