Submit | All submissions | Best solutions | Back to list |
ARNAB1 - Insert and Search |
Professor Arnab is hiding some gold coins in a field. Students are required to find the gold coins. Since the professor is very busy person, he assigns you the task of hiding the coins. Since, you are a student, you will help your friends by telling them if there is a coin at the coordinate given by your friends.
Input
You will be given 2 types of queries : Insert (0) and Search (1).
- 0 x y: Insert a coin at (x, y)
- 1 x y: Report if there is a coin at (x, y)
Output
For every query, print the query statement as it is. For Search query, print "Yes" or "No" (quotes only for clarity) accordingly. For every query, print a blank line at the end.
Note:
* The coordinates (x, y) will be such that both x and y have at most 6 digits after the decimal. Output format as sir told.
Constraints
0 <= x <= 1
0 <= y <= 1
Total Queries <= 1e5
Example
Input: 0 0.2777 0.0886 0 0.8335 0.7793 1 0.6649 0.0492 0 0.0027 0.2362 0 0.7763 0.0059 0 0.3426 0.0540 0 0.5211 0.5736 0 0.6429 0.2567 1 0.2777 0.0886 1 0.3426 0.0540 Output: 0 0.277700 0.088600 0 0.833500 0.779300 1 0.664900 0.049200 No 0 0.002700 0.236200 0 0.776300 0.005900 0 0.342600 0.054000 0 0.521100 0.573600 0 0.642900 0.256700 1 0.277700 0.088600 Yes 1 0.342600 0.054000 YesCredits: Saurav Kumar for writing story.
As this is tutorial problem, try to solve this problem using quadtrees and kdtrees to learn about them.
Added by: | devu |
Date: | 2015-01-22 |
Time limit: | 20s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 JS-MONKEY |