Back
Close

The alien business of cows

Statement

 Goal

Within the Universe, Earth cows are highly prized. Some would accuse aliens of stealing them to supply the best restaurants in the galaxy with meat. Others argue that cows are used as Earth ambassadors within the galaxy, because aliens have experimented with all the beings of Earth, and have learned that cows are the most intelligent and wise.

On 23rd of March 1983, President Ronald Reagan of the USA announced the Strategic Defense Initiative (SDI), nicknamed by the medias as the Star Wars program. Although most people thought that it was a missile defense system to protect the USA from USSR attacks by ballistic nuclear weapons, the Department of Defense organized it as the military answer to alien operations on North America. Since the beginning of 1984, the Homing Overlay Experiment (HOE) provides hit-to-kill missiles going up to 6km/s to search and destroy any object until an altitude of 160 km. Those Minuteman missiles are launched from the Space Launch Complexe 1 of the Vandenberg Space Force Base, Santa Barbara County, California (34°45'21.8"N, 120°37'34.8"W, elevation: 46 meters).

You are an alien mercenary working for the Corporation of Abduction and Transfer of Typical Livestock from Earth (C.A.T.T.L.E.), the biggest industry of its kind in the Milky Way. This corporation has a hidden base on one of Jupiter's moons, from where different types of collectors are sent to Earth. Your corporation takes a very dim view of the new earth defense system, which has already caused the company's stock to fall in value on the Universe stock exchange. The CEO, Elon Mowsk, has tasked you with defining the feasibility of upcoming missions.

C.A.T.T.L.E. collectors take off vertically at a speed of collector speed to escape Earth's gravity, and this speed is kept until the moon orbit altitude (385 000km). A collector aims at its target point, stops at 500 meters above the ground, out of effective range of assault rifles. It then abducts as many cows as possible until collector maximum capacity, and takes off. To not kill the cow during the abduction, they are captured one by one at a speed of 9.81m/s . This collecting speed is multiplied by the collector levitation efficiency parameter.
However, once the abducting device is on, a special SDI radar detects it and a MinuteMan missile is immediately launched at maximum speed from the Space Launch Complexe 1 of the Vandenberg Space Force Base. It goes in a straight line from the silo to its limit altitude above the anomaly pointed by the HOE radar, then fall vertically. If it collides with a C.A.T.T.L.E. collector, both explode, Elon Mowsk is furious, the collector crew is dead, and you are held responsible for the deaths.

As you don't want to go to intergalactic jail, you must tell if a mission is possible or not, given the name of the destination, its latitude, longitude, and elevation. A mission is possible if one collector abduct cows and flee without getting hit by a MinuteMan missile. if the mission is possible, you have to give the collector type to send and the number of cows it will bring back. Beware, sending a collector has a cost that must be covered by the number of cows brought back.

Collectors type
The VaCoWM Cleaner is the formula 1 of the collectors. Designed to be fast, it can get to 44.7 km/s in Earth atmosphere. However, the lack of space limits the capacity to 3 cows only, and its smaller abduction beams has a levitation efficiency of 0.8. It is the cheapest collector, and make profitable missions if it brings back at least one cow.
The L4nd MoWer is the medium collector. It was designed to have a good balance between speed (22.38 km/s and capacity (10 cows), with a good quality abduction device (efficiency of 1.2). 4th generation of its kind, it must bring back at least 6 cows to be profitable.
The Cow Harvester is the biggest of its kind, just fast enough to escape Earth's gravity (11.19 km/s). Its "slowness" is compensated by its capacity (20 cows !) and its premium abduction device which can levitate cows with an impressive 1.5 efficiency. King of collectors, it is not cheap to send it, and must bring at least 14 cows for a mission to be worth it.

Example
If a L4nd Mower can get 8 cows and a VaCoWM 3 cows, send the first one (more cows !). But if a L4nd Mower can get 5 cows and a VaCoWM 3 cows, send the last one, because sending the first one is not profitable.
Input
First line : N number of upcoming missions.
N next lines : a string upcomingMission with the name of the location, coordinates latitude and longitude in degrees/minutes/seconds, elevation in meters.
Output
N lines : For each mission, the output form should be one of these :
name of the location: impossible.
name of the location: possible. Send a collector type to bring back number of abducted cows cow/ cows. (English rules, so cow has an s if there is more than one cow).
Constraints
The cow-llect area is North america. Hence :
- latitude is always in N
- longitude is always in W
PI = 3.14159265359

Help
Coordinates in degrees/minutes/seconds should be converted to decimal using the simplest conversion: Decimal Degrees = degrees + (minutes/60) + (seconds/3600).
- One degree in latitude is equal to 111.11 km.
- One degree in longitude between two points is equal to 111.11*cos( (latitude1+latitude2) /2).
Be careful of the actual unit expected by the platform cos function !
Example
Input
11
Boadwine Farms Inc (South Dakota, USA) 43°44'41.7"N 96°49'37.4"W 496
George Farms (Wyoming, USA) 44°38'39.1"N 108°58'19.0"W 1467
Coronado Dairy (Arizona, USA) 32°01'35.6"N 109°45'44.3"W 1289
Peaceful Hills Farm (Missouri, USA) 39°04'39.6"N 94°11'49.5"W 282
Grotegut Dairy Farm Inc (Wisconsin, USA) 43°59'33.9"N 87°45'19.2"W 227
Crooked Creek Farm Dairy (Michigan, USA) 42°51'18.8"N 82°59'26.4"W 237
MVP Dairy, LLC (Ohio, USA) 40°37'28.0"N 84°31'41.0"W 253
The Family Cow (Pennsylvania, USA) 39°58'02.7"N 77°34'26.9"W 213
Kleinpeter Farms Dairy LLC (Louisiana, USA) 30°21'47.1"N 91°01'21.1"W 8
Working Cows Dairy (Alabama, USA) 31°11'14.2"N 85°36'06.3"W 83
Happy Cow Creamery (South Carolina, USA) 34°36'51.1"N 82°21'13.1"W 249
Output
Boadwine Farms Inc (South Dakota, USA): possible. Send a L4nd MoWer to bring back 8 cows.
George Farms (Wyoming, USA): possible. Send a VaCoWM Cleaner to bring back 3 cows.
Coronado Dairy (Arizona, USA): possible. Send a VaCoWM Cleaner to bring back 2 cows.
Peaceful Hills Farm (Missouri, USA): possible. Send a L4nd MoWer to bring back 9 cows.
Grotegut Dairy Farm Inc (Wisconsin, USA): possible. Send a Cow Harvester to bring back 14 cows.
Crooked Creek Farm Dairy (Michigan, USA): possible. Send a Cow Harvester to bring back 16 cows.
MVP Dairy, LLC (Ohio, USA): possible. Send a Cow Harvester to bring back 15 cows.
The Family Cow (Pennsylvania, USA): possible. Send a Cow Harvester to bring back 18 cows.
Kleinpeter Farms Dairy LLC (Louisiana, USA): possible. Send a L4nd MoWer to bring back 10 cows.
Working Cows Dairy (Alabama, USA): possible. Send a Cow Harvester to bring back 15 cows.
Happy Cow Creamery (South Carolina, USA): possible. Send a Cow Harvester to bring back 16 cows.

Tags
Reading the statementDistancesLogicString manipulation

Difficulty
Easy

Test cases
United Steak of America Test
Input
11 Boadwine Farms Inc (South Dakota, USA) 43°44'41.7"N 96°49'37.4"W 496 George Farms (Wyoming, USA) 44°38'39.1"N 108°58'19.0"W 1467 Coronado Dairy (Arizona, USA) 32°01'35.6"N 109°45'44.3"W 1289 Peaceful Hills Farm (Missouri, USA) 39°04'39.6"N 94°11'49.5"W 282 Grotegut Dairy Farm Inc (Wisconsin, USA) 43°59'33.9"N 87°45'19.2"W 227 Crooked Creek Farm Dairy (Michigan, USA) 42°51'18.8"N 82°59'26.4"W 237 MVP Dairy, LLC (Ohio, USA) 40°37'28.0"N 84°31'41.0"W 253 The Family Cow (Pennsylvania, USA) 39°58'02.7"N 77°34'26.9"W 213 Kleinpeter Farms Dairy LLC (Louisiana, USA) 30°21'47.1"N 91°01'21.1"W 8 Working Cows Dairy (Alabama, USA) 31°11'14.2"N 85°36'06.3"W 83 Happy Cow Creamery (South Carolina, USA) 34°36'51.1"N 82°21'13.1"W 249
Output
Boadwine Farms Inc (South Dakota, USA): possible. Send a L4nd MoWer to bring back 8 cows. George Farms (Wyoming, USA): possible. Send a VaCoWM Cleaner to bring back 3 cows. Coronado Dairy (Arizona, USA): possible. Send a VaCoWM Cleaner to bring back 2 cows. Peaceful Hills Farm (Missouri, USA): possible. Send a L4nd MoWer to bring back 9 cows. Grotegut Dairy Farm Inc (Wisconsin, USA): possible. Send a Cow Harvester to bring back 14 cows. Crooked Creek Farm Dairy (Michigan, USA): possible. Send a Cow Harvester to bring back 16 cows. MVP Dairy, LLC (Ohio, USA): possible. Send a Cow Harvester to bring back 15 cows. The Family Cow (Pennsylvania, USA): possible. Send a Cow Harvester to bring back 18 cows. Kleinpeter Farms Dairy LLC (Louisiana, USA): possible. Send a L4nd MoWer to bring back 10 cows. Working Cows Dairy (Alabama, USA): possible. Send a Cow Harvester to bring back 15 cows. Happy Cow Creamery (South Carolina, USA): possible. Send a Cow Harvester to bring back 16 cows.

United Steak of America Validator
Input
11 The Milkhouse Farm & Dairy (Maine, USA) 44°12'38.2"N 69°59'15.7"W 70 Bryant Dairy Farm (Nebraska, USA) 41°22'19.5"N 96°07'01.2"W 362 Schiefelbein Farms (Minnesota, USA) 45°15'29.4"N 94°17'26.6"W 364 Morning Fresh Dairy Farm (Colorado, USA) 40°38'51.6"N 105°11'00.1"W 1578 VanBedaf Dairy (North dakota, USA) 47°26'18.6"N 99°03'11.8"W 470 Oz Highland Farm (Kansas, USA) 38°54'18.7"N 95°51'02.7"W 322 The Howard Farm (Arkansas, USA) 35°56'22.2"N 94°00'41.0"W 429 Fair Oaks Farms (Indiana, USA) 41°00'37.8"N 87°16'42.1"W 210 Harvest Home Dairy Farm (Kentucky, USA) 38°19'13.9"N 85°20'33.3"W 226 Middleton Dairy Farm (Mississippi, USA) 30°39'08.1"N 88°26'48.8"W 16 Hunter Cattle Company (Georgia, USA) 32°22'17.1"N 81°33'27.3"W 21
Output
The Milkhouse Farm & Dairy (Maine, USA): possible. Send a Cow Harvester to bring back 20 cows. Bryant Dairy Farm (Nebraska, USA): possible. Send a L4nd MoWer to bring back 8 cows. Schiefelbein Farms (Minnesota, USA): possible. Send a L4nd MoWer to bring back 9 cows. Morning Fresh Dairy Farm (Colorado, USA): possible. Send a VaCoWM Cleaner to bring back 3 cows. VanBedaf Dairy (North dakota, USA): possible. Send a L4nd MoWer to bring back 8 cows. Oz Highland Farm (Kansas, USA): possible. Send a L4nd MoWer to bring back 8 cows. The Howard Farm (Arkansas, USA): possible. Send a L4nd MoWer to bring back 9 cows. Fair Oaks Farms (Indiana, USA): possible. Send a Cow Harvester to bring back 14 cows. Harvest Home Dairy Farm (Kentucky, USA): possible. Send a Cow Harvester to bring back 15 cows. Middleton Dairy Farm (Mississippi, USA): possible. Send a Cow Harvester to bring back 14 cows. Hunter Cattle Company (Georgia, USA): possible. Send a Cow Harvester to bring back 17 cows.

Free Tacow ! Test
Input
8 Rancho Ontiveros (Baja California, Mexico) 32°32'25.1"N 116°51'21.5"W 110 Rancho El Mezquite JR (Sonora, Mexico) 27°29'46.8"N 110°08'16.3"W 19 Rancho La Laguna (Sinaloa, Mexico) 26°14'52.7"N 108°56'30.9"W 33 Regional Livestock Union of Coahuila (Coahuila, Mexico) 28°32'27.3"N 100°29'11.7"W 268 Rancho El Sauce y la Palma (Zacatecas, Mexico) 23°00'35.2"N 102°44'57.4"W 2156 Establo Hernández Hermanos (Jalisco, Mexico) 21°00'32.2"N 102°06'48.7"W 2064 Rancho El Cuajilote (Guerrero, Mexico) 16°51'29.3"N 98°43'35.9"W 304 Rancho Guadalupe (Yucatan, Mexico) 21°13'10.8"N 88°48'23.2"W 9
Output
Rancho Ontiveros (Baja California, Mexico): possible. Send a VaCoWM Cleaner to bring back 1 cow. Rancho El Mezquite JR (Sonora, Mexico): possible. Send a VaCoWM Cleaner to bring back 3 cows. Rancho La Laguna (Sinaloa, Mexico): possible. Send a VaCoWM Cleaner to bring back 3 cows. Regional Livestock Union of Coahuila (Coahuila, Mexico): possible. Send a L4nd MoWer to bring back 7 cows. Rancho El Sauce y la Palma (Zacatecas, Mexico): possible. Send a L4nd MoWer to bring back 8 cows. Establo Hernández Hermanos (Jalisco, Mexico): possible. Send a L4nd MoWer to bring back 9 cows. Rancho El Cuajilote (Guerrero, Mexico): possible. Send a Cow Harvester to bring back 14 cows. Rancho Guadalupe (Yucatan, Mexico): possible. Send a Cow Harvester to bring back 16 cows.

Free Tacow ! Validator
Input
8 Rancho Cacachilas (Baja California Sur, Mexico) 24°02'45.2"N 110°04'04.6"W 471 Regional Livestock Union of Chihuahua (Chihuahua, Mexico) 28°34'41.8"N 106°07'28.4"W 1523 Aropecuaria San Isidro Del Malpais (Durango, Mexico) 24°01'33.0"N 104°20'13.0"W 1846 Rancho La Costa (Tamaulipas, Mexico) 23°33'40.5"N 97°59'25.2"W 141 RANCHO LOS CAMARENA (Nayarit, Mexico) 22°23'52.7"N 105°33'51.9"W 11 Localidad. Rancho La Corucha (Michoacan, Mexico) 19°33'17.5"N 101°18'04.9"W 2019 Rancho El porvenir (Tabasco, Mexico) 17°56'20.4"N 93°10'09.9"W 20 Rancho El Remolino (Campeche, Mexico) 20°17'18.2"N 90°04'02.5"W 10
Output
Rancho Cacachilas (Baja California Sur, Mexico): possible. Send a L4nd MoWer to bring back 6 cows. Regional Livestock Union of Chihuahua (Chihuahua, Mexico): possible. Send a VaCoWM Cleaner to bring back 3 cows. Aropecuaria San Isidro Del Malpais (Durango, Mexico): possible. Send a L4nd MoWer to bring back 7 cows. Rancho La Costa (Tamaulipas, Mexico): possible. Send a L4nd MoWer to bring back 9 cows. RANCHO LOS CAMARENA (Nayarit, Mexico): possible. Send a L4nd MoWer to bring back 7 cows. Localidad. Rancho La Corucha (Michoacan, Mexico): possible. Send a L4nd MoWer to bring back 9 cows. Rancho El porvenir (Tabasco, Mexico): possible. Send a Cow Harvester to bring back 15 cows. Rancho El Remolino (Campeche, Mexico): possible. Send a Cow Harvester to bring back 16 cows.

Is that a Mowse ? Test
Input
4 Heart Of The Valley Farms (British Columbia, Canada) 49°45'12.8"N 125°05'19.6"W 54 Woodlands Ranching - Bred Heifers For Sale Saskatchewan (Saskatchewan, Canada) 50°41'10.0"N 104°41'24.4"W 581 Ferme Majonick (Québec, Canada) 45°55'20.8"N 73°42'44.4"W 73 Carriage Lane Livestock (New Brunswick, Canada) 45°56'51.6"N 65°53'39.0"W 53
Output
Heart Of The Valley Farms (British Columbia, Canada): possible. Send a L4nd MoWer to bring back 6 cows. Woodlands Ranching - Bred Heifers For Sale Saskatchewan (Saskatchewan, Canada): possible. Send a L4nd MoWer to bring back 8 cows. Ferme Majonick (Québec, Canada): possible. Send a Cow Harvester to bring back 20 cows. Carriage Lane Livestock (New Brunswick, Canada): possible. Send a Cow Harvester to bring back 20 cows.

Is that a Mowse ? Validator
Input
4 Wolfe Farms (Alberta, Canada) 54°49'17.4"N 117°26'17.9"W 755 Hockridge Farms (Manitoba, Canada) 51°07'04.0"N 100°08'02.4"W 309 Jaspers Dairy Farm (Ontario, Canada) 48°17'25.1"N 89°30'24.5"W 241 Bokma Farms (Nova Scotia, Canada) 45°04'19.2"N 63°25'14.6"W 37
Output
Wolfe Farms (Alberta, Canada): possible. Send a L4nd MoWer to bring back 8 cows. Hockridge Farms (Manitoba, Canada): possible. Send a L4nd MoWer to bring back 9 cows. Jaspers Dairy Farm (Ontario, Canada): possible. Send a Cow Harvester to bring back 14 cows. Bokma Farms (Nova Scotia, Canada): possible. Send a Cow Harvester to bring back 20 cows.

Those missions are stupid Test
Input
4 Space Launch Complexe 1 of the Vandenberg Space Force Base (California, USA) 34°45'21.8"N 120°37'34.8"W 46 Mont St Helens (Washington, USA) 46°11'28.9"N 122°11'43.9"W 2529 Area 51 (Nevada, USA) 37°15'02.5"N 115°48'31.7"W 1364 White House (USA) 38°53'51.6"N 77°02'11.5"W 18
Output
Space Launch Complexe 1 of the Vandenberg Space Force Base (California, USA): impossible. Mont St Helens (Washington, USA): possible. Send a VaCoWM Cleaner to bring back 3 cows. Area 51 (Nevada, USA): possible. Send a VaCoWM Cleaner to bring back 1 cow. White House (USA): possible. Send a Cow Harvester to bring back 18 cows.

This is a polar bear, not a cow ! Validator
Input
2 Hungate Farms Llc (Alaska, USA) 61°34'50.9"N 149°36'29.7"W 93 JAE Farms (Nunavut, Canada) 53°19'35.4"N 104°01'12.9"W 376
Output
Hungate Farms Llc (Alaska, USA): possible. Send a Cow Harvester to bring back 17 cows. JAE Farms (Nunavut, Canada): possible. Send a L4nd MoWer to bring back 9 cows.

Union of Steak Amateurs Test
Input
8 El Oro Cattle Feeders (Washington, USA) 47°03'11.8"N 119°05'23.4"W 346 Schoch Dairy & Creamery (Oregon, USA) 45°34'49.2"N 122°55'34.8"W 66 Utah Natural Meat And Milk (Utah, USA) 40°36'59.3"N 112°01'26.1"W 1460 De Smet Dairy and Creamery (New Mexico, USA) 34°50'20.1"N 106°42'22.3"W 1482 Alderspring Ranch Grassfed Organic Beef (Idaho, USA) 44°36'27.0"N 113°58'36.6"W 1490 Cow Creek Farm (Florida, USA) 28°06'25.4"N 82°13'34.9"W 20 Freedom Hill Farm (New York, USA) 46°55'17.1"N 117°39'56.8"W 525 Swan Bros. Dairy (Oklahoma, USA) 36°18'32.8"N 95°35'46.6"W 198
Output
El Oro Cattle Feeders (Washington, USA): possible. Send a VaCoWM Cleaner to bring back 3 cows. Schoch Dairy & Creamery (Oregon, USA): possible. Send a VaCoWM Cleaner to bring back 3 cows. Utah Natural Meat And Milk (Utah, USA): possible. Send a VaCoWM Cleaner to bring back 2 cows. De Smet Dairy and Creamery (New Mexico, USA): possible. Send a VaCoWM Cleaner to bring back 3 cows. Alderspring Ranch Grassfed Organic Beef (Idaho, USA): possible. Send a VaCoWM Cleaner to bring back 3 cows. Cow Creek Farm (Florida, USA): possible. Send a Cow Harvester to bring back 17 cows. Freedom Hill Farm (New York, USA): possible. Send a VaCoWM Cleaner to bring back 3 cows. Swan Bros. Dairy (Oklahoma, USA): possible. Send a L4nd MoWer to bring back 8 cows.

Union of Steak Amateurs Validator
Input
8 Ninja Cow Farms LLC (North Carolina, USA) 35°40'41.7"N 78°39'12.4"W 94 Perigo Hay and Cattle (Nevada, USA) 38°54'32.0"N 115°01'24.8"W 1708 Hatcher Family Dairy (Tennessee, USA) 35°48'51.9"N 86°44'14.7"W 232 Falster Farm and Mini Cattle (Texas, USA) 32°51'19.7"N 95°19'07.9"W 134 Richlands Dairy Farm (Virginia, USA) 37°07'58.4"N 77°53'41.8"W 119 Golden Oaks Farm (Illinois, USA) 42°16'53.0"N 88°09'58.8"W 242 Hansen's Farm Fresh Dairy (Iowa, USA) 42°23'32.3"N 92°28'28.8"W 283 Oxbox Cattle Company (Montana, USA) 46°48'00.9"N 114°05'07.6"W 962
Output
Ninja Cow Farms LLC (North Carolina, USA): possible. Send a Cow Harvester to bring back 18 cows. Perigo Hay and Cattle (Nevada, USA): possible. Send a VaCoWM Cleaner to bring back 1 cow. Hatcher Family Dairy (Tennessee, USA): possible. Send a Cow Harvester to bring back 14 cows. Falster Farm and Mini Cattle (Texas, USA): possible. Send a L4nd MoWer to bring back 9 cows. Richlands Dairy Farm (Virginia, USA): possible. Send a Cow Harvester to bring back 18 cows. Golden Oaks Farm (Illinois, USA): possible. Send a Cow Harvester to bring back 14 cows. Hansen's Farm Fresh Dairy (Iowa, USA): possible. Send a L4nd MoWer to bring back 10 cows. Oxbox Cattle Company (Montana, USA): possible. Send a VaCoWM Cleaner to bring back 3 cows.

Solution language

Solution

Stub generator input