TEKKEN - Editorial

Author: notsoloud
Testers: iceknight1093, rivalq
Editorialist: iceknight1093

TBD

None

PROBLEM:

Anna, Bob, and Claudio have initial health levels of A, B, and C respectively. Each pair will fight exactly once.
When two players with health x and y fight, both of their health decreases by \min(x, y).

Is there an order of fights that will leave Anna with strictly positive health in the end?

EXPLANATION:

Since Anna wants to have lots of health remaining, ideally the others should have as little as possible when she fights them.

So, itâ€™s optimal for Bob and Claudio to fight first.
After this fight, their new health levels are B - \min(B, C) and C - \min(B, C) respectively.

Now make both people fight Anna, and check if her remaining health is positive or not.
Note that the order in which she fights them now is irrelevant.

A little analysis should tell you that this can be reduced to the condition

A \gt \max(B, C) - \min(B, C)

which can be checked using an if statement.

TIME COMPLEXITY

\mathcal{O}(1) per test case.

CODE:

Editorialist's code (Python)
for _ in range(int(input())):
a, b, c = map(int, input().split())
print('Yes' if a > max(b, c) - min(b, c) else 'No')