Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi need an answer Asap preferred languages java and python Somebody has been grazing in Farmer John's (1G105) private gardens! Using his expert forensic knowledge,

image text in transcribedHi need an answer Asap preferred languages java and python

Somebody has been grazing in Farmer John's (1G105) private gardens! Using his expert forensic knowledge, FJ has been able to determine the precise time each garden was grazed. He has also determined that there was a single cow that was responsible for every grazing incident. In response to these crimes each of FJ's N(1N105) cows have provided an alibi that proves the cow was in a specific location at a specific time. Help FJ test whether each of these alibis demonstrates the cow's innocence. A cow can be determined to be innocent if it is impossible for her to have travelled between all of the grazings and her alibi. Cows travel at a rate of 1 unit distance per unit time. INPUT FORMAT (input arrives from the terminal / stdin): The first line of input will contain G and N separated by a space. The next G lines contain the integers x,y, and t(109x,y109;0t109) separated by a space describing the location and time of the grazing. It will always be possible for a single cow to travel between all grazings. The next N lines contain x,y, and t(109x,y109;0t109) separated by a space describing the location and time of each cow's alibi. OUTPUT FORMAT (print output to the terminal / stdout): Output a single integer: the number of cows with alibis that prove their innocence. SAMPLE INPUT: 205001000501040050100000100200500200170 SAMPLE OUTPUT: 2 There were two grazings; the first at (0,0) at time 100 and the second at (50,0) at time 200. The first cow's alibi does not prove her innocence. She has just enough time to arrive at the first grazing. The second cow's alibi does prove her innocence. She is nowhere near any of the grazings. Unfortunately for the third cow, being at the scene of the crime does not prove innocence. Finally, the fourth cow is innocent because it's impossible to make it from her alibi to the final grazing in time. SCORING: - Inputs 2-4: 1G,N103. Also, for both the fields and alibis, 106x,y106 and 0t106. - Inputs 5-11: No additional constraints

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

Convert 0.203 m/min to meters/second.

Answered: 1 week ago

Question

A _ _ _ _ _ _ _ _ _ _ is considered a peripheral device.

Answered: 1 week ago

Question

Distinguish between a LAN, MAN, and WAN.

Answered: 1 week ago

Question

Which are non projected Teaching aids in advance learning system?

Answered: 1 week ago