CHOLY - Editorial

PROBLEM LINK:

Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4

Author: iceknight1093
Tester: tabr
Editorialist: iceknight1093

DIFFICULTY:

TBD

PREREQUISITES:

None

PROBLEM:

A round in the chess olympiad consists of four games, with a win awarding 1 point and a draw 0.5.
The team with more points wins the round.
If X wins, Y draws, and Z losses have already happened, can your team still win?

EXPLANATION:

With X wins and Y draws, our current score is X + \frac{Y}{2}.
Our opponent’s current score is Z + \frac{Y}{2}, since our loss is their win.

The number of games remaining is R = 4 - (X+Y+Z).
Ideally, we win all of these games, giving us R more points.
This makes our best possible final score R + X + \frac{Y}{2}.

We win the round if this is higher than the opponent’s score, that is,

R+X+\frac{Y}{2} \gt Z + \frac{Y}{2}

or even simpler,

R+X \gt Z

TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

CODE:

Editorialist's code (Python)
x, y, z = map(int, input().split())
rem = 4 - x - y - z
print('Yes' if x+rem > z else 'No')