Four To The Floor Four To The Floor
Simple
UK RU English
The mission is in Blocked Mode. Access to the solutions is blocked for a day or two (even after you share your own), until we'll have enough solutions for you to check. All users who've solved the mission will get the notifications about their opening.

The mission was created with the support of Ajax company

In 2011, Ajax Systems was just an ambitious idea. Today, our security systems are being sold in 90 countries and protect more than 350 thousand people. Over the past 3 years, the company has become 30 times larger and has already sold more than two million devices. Each of them is designed, manufactured and tested in Kiev.

Ajax, as a system, is not just a set of sensors, but also beautiful...

If there's a need for motion detection, we have various options at our disposal, all based on the general principle of tracking environmental change. Narrowing the concept of "motion detection" down to the concept of "human detection", it becomes obvious that one of the most convenient way to detect a human presence (entrance) is to keep tracking constantly a certain distinctive environmental characteristic that is attributable for a human as well as for any other possible object. And this kind of a characteristic really exists. Everything in the world emits thermal radiation. The radiation density depends on the temperature of the object and its surface area. And here I must add that infrared light is nothing but thermal radiation. Although this radiation is not visible to the human eye, it is quite intense. You can feel it if place your palm near (not onto!) a hot object, a cup of coffee for example.


room

Knowing mentioned above, it's quite easy to realize how PIR sensor systems operate, right? Imagine a locked room and a sensor "looking" down from the ceiling (or look at the schema below). Remember that everything emits thermal radiation, so our sensor will register a conventionally constant level of the background thermal emission, so called thermal imprint. In order a PIR sensor system won't be triggered by a pet, the maintainers of such a system increase its sensitivity threshold. That threshold isn't that high though, especially taking into account the human body that emits ~1kW of thermal radiation. So when a man enters a sensor's field of view, the sensor detects significantly increased level of thermal radiation and triggers either a security system which notifies the owner or a lighting system which turns on the lights.


PIR sensor


And now, finally, the mission's objective. Given a room's size and a list of PIR sensors mounted on the room's ceiling and looking down on the floor, your task is to determine whether the floor area is completely into the sensors coverage area (return True) or not (return False). The bottom left corner of the rectangle matches the origin point O, the top right corner is defined by W and H. Each sensor is defined by its mounting point (coordinates xi and yi) and its range (Ri).

Input: Two arguments:

  • the first is a list containing a room's top right corner coordinates,all are integers [W, H]
  • the second is a list containing sensors info, all are integers [[xi, yi, Ri], [xi+1, yi+1, Ri+1], ....., [xn, yn, Rn]]

Output: True or False.

Example:

is_covered([200, 150], [[100, 75, 130]]) == True                                   #example #1
is_covered([200, 150], [[50, 75, 100], [150, 75, 100]]) == True                    #example #2
is_covered([200, 150], [[50, 75, 100], [150, 25, 50], [150, 125, 50]]) == False    #example #3

PIR sensor

Precondition:
All given values are integers.

  • if (int - 10e-6 < f < int + 10e-6) then (f == int)
  • H ∈ (0; 1000]
  • W ∈ [H; 4*H]
  • xi ∈ [0; W]
  • yi ∈ [0; H]
  • Ri ∈ (0; 1600]
  • n ∈ [1; 10]
You should be an authorized user in order to see the full description and start solving this mission.