#C10099. Balanced Problem Set
Balanced Problem Set
Balanced Problem Set
In this problem, you are given the required and available counts of problems at three difficulty levels: easy, medium, and hard. A problem set is considered balanced if, for each difficulty level, the available count is at least the required count. Formally, the condition can be written in LaTeX as follows:
$$e2 \ge e1,\quad m2 \ge m1,\quad h2 \ge h1$$
Your task is to determine whether each problem set is balanced.
inputFormat
The input begins with an integer T
representing the number of test cases. Each test case consists of a single line containing six space-separated integers: e1 e2 m1 m2 h1 h2
, where:
e1
is the required number of easy problems ande2
is the available number of easy problems.m1
is the required number of medium problems andm2
is the available number of medium problems.h1
is the required number of hard problems andh2
is the available number of hard problems.
outputFormat
For each test case, output a single line containing either BALANCED
if the available counts for each difficulty are at least the required counts, or UNBALANCED
otherwise.
3
10 15 5 10 3 5
8 5 6 6 2 1
4 4 2 2 3 3
BALANCED
UNBALANCED
BALANCED
</p>