CRICUP Editorial

PROBLEM LINK:

Contest Division 1
Contest Division 2
Contest Division 3
Contest Division 4

Setter: Tejas Pandey
Tester: Aryan, Takuki Kurokawa
Editorialist: Pratiyush Mishra

DIFFICULTY:

Cakewalk

PREREQUISITES:

None

PROBLEM:

Its the World Cup Finals. Chef only finds a match interesting if the skill difference of the competing teams is less than or equal to D.

Given that the skills of the teams competing in the final are X and Y respectively, determine whether Chef will find the game interesting or not.

EXPLANATION:

For every test case we are given 3 space seperated integers, the first two denoting the skill levels of two teams & the third being the maximum permissible skill difference for the game to be interesting.

For the purpose of this question X & Y are interchangable since only the skill difference between the teams is of our interest, hence we need to evaluate the absolute difference between these 2 values.

  • When (X>Y) then the absolute difference = (X-Y)
  • Otherwise the absolute difference = (Y-X)

If the above calculated difference is more than D then the game is NOT INTERESTING else it is INTERESTING.

TIME COMPLEXITY:

O(1) for each test case.

SOLUTION:

Editorialist’s Solution
Setter’s Solution
Tester-1’s Solution
Tester-2’s Solution