#C5859. Moisture Level Stability Check
Moisture Level Stability Check
Moisture Level Stability Check
You are given a monitoring system for a facility that is divided into several sections. Each section has multiple moisture readings. The system works with a minimum threshold \(L\) and a maximum threshold \(U\). Your task is to check if every moisture reading in all sections is within the inclusive range \([L, U]\). If every reading meets the criteria, print STABLE
, otherwise print UNSTABLE
.
Input Format: The first line contains four integers: the number of sections, the number of readings per section, the minimum threshold \(L\), and the maximum threshold \(U\). This is followed by a number of lines equal to the number of sections, each containing the readings for that section separated by spaces.
inputFormat
The first line of input contains four space-separated integers: sections
, readings
, min_threshold
(\(L\)), and max_threshold
(\(U\)). Each of the next sections
lines contains readings
integers representing the moisture readings for that section. All readings are separated by spaces.
outputFormat
Output a single string: STABLE
if every reading in every section is between \(L\) and \(U\) (inclusive). Otherwise, output UNSTABLE
.
3 4 10 50
12 48 30 25
10 20 25 45
11 30 30 40
STABLE