Problem Submissions Discussions Karen Smith is one of those gifted teens with the power of ESPN. For us normal people, this skill is also known as telepathy. She can read the minds of people around her, which helps her out because she loves gossip. She frequently just sits in crowded areas around North Shore High School and uses her ESPN to read the minds of the people around her. After picking up gossip, she goes to her friends Cady, Regina, and Gretchen to tell them all these "fetch" stories. However, the range of her ESPN is limited. Before she starts collecting gossip, she must prepare a certain amount of ESPN energy E before starting to read people's minds. If she accumulates E energy, she can read the minds of the people who are at most E units away from her. Distance between two points (1,31) and (#2, 32) is defined as the Manhattan distance D = |x1 - x2|+|y1 - y2| Karen goes to the cafeteria to start collecting gossip. She positions herself at the coordinates (K, Ky) and prepares E energy. Given the positions of the N people in the cafeteria, how many people can Karen collect gossip from? Input Format Input consists of one test case beginning with three space-separated integers N, K₂, and Ky which are the number of people in the cafeteria, and Karen's location respectively. N lines follow, the ith of which containing two space-separated integers X; and Y; denoting the coordinates of the ith person. The next line contains a single integer Q. You must answer queries. The next Q lines contain an integer E, which is the energy of Karen for that query. Constraints 0 ≤N ≤ 105 0≤ K₂, Kyl, X, Y| ≤ 108 0≤E≤ 4.108 1≤Q≤ 105 Output Format For each query, output one line containing a single integer which denotes the number of people within range of Karen's ESPN.
Problem Submissions Discussions Karen Smith is one of those gifted teens with the power of ESPN. For us normal people, this skill is also known as telepathy. She can read the minds of people around her, which helps her out because she loves gossip. She frequently just sits in crowded areas around North Shore High School and uses her ESPN to read the minds of the people around her. After picking up gossip, she goes to her friends Cady, Regina, and Gretchen to tell them all these "fetch" stories. However, the range of her ESPN is limited. Before she starts collecting gossip, she must prepare a certain amount of ESPN energy E before starting to read people's minds. If she accumulates E energy, she can read the minds of the people who are at most E units away from her. Distance between two points (1,31) and (#2, 32) is defined as the Manhattan distance D = |x1 - x2|+|y1 - y2| Karen goes to the cafeteria to start collecting gossip. She positions herself at the coordinates (K, Ky) and prepares E energy. Given the positions of the N people in the cafeteria, how many people can Karen collect gossip from? Input Format Input consists of one test case beginning with three space-separated integers N, K₂, and Ky which are the number of people in the cafeteria, and Karen's location respectively. N lines follow, the ith of which containing two space-separated integers X; and Y; denoting the coordinates of the ith person. The next line contains a single integer Q. You must answer queries. The next Q lines contain an integer E, which is the energy of Karen for that query. Constraints 0 ≤N ≤ 105 0≤ K₂, Kyl, X, Y| ≤ 108 0≤E≤ 4.108 1≤Q≤ 105 Output Format For each query, output one line containing a single integer which denotes the number of people within range of Karen's ESPN.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
ESPN Problem Set
Kindly answer using Divide and Conquer
Tip: Use Binary search and sorting to answer the queries
Take note that code should abide by the rules of the online judge (Hackerrank)
Also place comments and documentation
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 5 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education