CHEFPAGES Editorial

PROBLEM LINK:

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

Setter: Srikkanth R
Tester: Harris Leung
Editorialist: Jakub Safin, Pratiyush Mishra

DIFFICULTY:

Cakewalk

PREREQUISITES:

None

PROBLEM:

Chef has noticed that some users are not aware of the practice page, and some others are not aware of the rated contests. So Chef wants to send an email to the users depending on which of these groups they fall into:

If the user has never submitted on the practice page then send an email with the text:

https://www.codechef.com/practice

If the user has submitted on the practice page, but never participated in a contest then send an email with the text:

https://www.codechef.com/contests

If the user has both (i) submitted on the practice page and (ii) participated in a contest then send an email with the text:

https://discuss.codechef.com

so that they may discuss with other members of the community.

Help Chef by writing a program that takes as input two integers A,B where

  • A=1 if the user has submitted on the practice page and 0 otherwise,
  • B=1 if the user has participated in a contest and 0 otherwise,

and outputs the appropriate link to be displayed in the email.

EXPLANATION:

For a particular test case, two integers A and B are taken as inputs which can take values 1 or 0.

As per the question, if A takes the value zero, then the practice link has to be sent. If A takes the value 1 then there are two possible scenarios:

  • B = 0; In this case the contest link has to be sent
  • B = 1; Here, the user has participated in a contest and submitted on the practice page, so the discussion link has to be sent.

TIME COMPLEXITY:

O(1) for each test case.

SOLUTION:

Editorialist’s Solution
Tester’s Solution

1 Like