POINTT - Editorial

PROBLEM LINK:

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

Author: pols_agyi_pols
Tester: kingmessi
Editorialist: iceknight1093

DIFFICULTY:

Cakewalk

PREREQUISITES:

None

PROBLEM:

Alice and Bob play a two-round game. Each player has a primary and secondary score.
The winner is whoever has a higher primary score. In the case of a tie, the higher secondary score wins. If it’s still tied, Alice wins.

Given Alice’s scores X and Y, and Bob’s scores A and B, determine the winner.

EXPLANATION:

One solution is to simply implement what is mentioned in the statement, as follows:

  • If X \ne A, then Alice wins if X \gt A and Bob wins if X \lt A.
  • Otherwise, we have X = A, i.e. equal primary scores.
    • Here, if Y \gt B then Alice wins and if Y \lt B then Bob wins.
    • If Y = B so both scores are tied, Alice wins.

To reduce the casework a bit, note that Bob can win only when either X \lt A, or (X = A and Y \lt B). In every other case, Alice wins.

TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

CODE:

Editorialist's code (PyPy3)
x, y, a, b = map(int, input().split())
if x < a or (x == a and y < b): print('Bob')
else: print('Alice')