Presentation on theme: "Computer Science Club The computer was born to solve problems that did not exist before. – Bill Gates."— Presentation transcript:
Computer Science Club The computer was born to solve problems that did not exist before. – Bill Gates
San Jose Holiday Parade Christmas in the Park canceled for CS club –No volunteer spots available Next Community Link event: San Jose holiday parade –December 5 th, 5:00 AM - 12:00 PM (report times vary) –Various volunteer positions More information at
Problem of the week SOLUTION
POW SOLUTION cont…
Problem of the Week Farmer John needs to sell a chunk of his land. Unfortunately, the land he sells inevitably affects the N cows (1 <= N <= 100,000) that graze on it. Given the start point, P s, and end point, P e, of grazing in meters (1 <= P s < P e <= 250,000) for each cow, answer Farmer Johns Q questions (1 <= Q <= 100,000). Each question will ask how many cows are affected by cutting out a piece of land from one point, Q s, to another, Q e (1 <= Q s < Q e <= 250,000).
Problem of the Week (cont.) Input: Line 1: Space-separated integers N and Q Lines 2 … N + 1: P s and P e for each cow on the farm Lines N + 2 … N + Q + 1: Space-separated integers Q s and Q e Output: Lines 1 … Q: One integer representing the answer to each question