You are not logged in. Please login at www.codechef.com to post your questions!

×

# SIMBABY - Editorial

Contest

Author: Shivank Pathak

Editorialist: Shivank Pathak

EASY

Math

# PROBLEM:

The problem is to calculate the optimal scores and check if the two persons have similar scores.

# EXPLANATION:

The order of covering the points is already defined, the problem just reduces to figuring out the way to calculate the scores between 2 points (A, B) and (C, D).

Note that what only matters is X = abs(A-C) and Y = abs(B-D).

While X and Y are positive, you will move along the diagonal and X and Y would both reduce by 1. When one of them becomes 0, you would move so that in each step the remaining number reduces by 1.

In other words, the total number of steps would correspond to max(X, Y).

Then we have to sort the scores of both and then compare it.

# AUTHOR'S AND TESTER'S SOLUTIONS:

Author's solution can be found here.

This question is marked "community wiki".

asked 15 Dec '18, 19:16 11
accept rate: 0% 19.8k350498541

 toggle preview community wiki:
Preview

### Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×15,852
×3,820
×890
×13

question asked: 15 Dec '18, 19:16

question was seen: 76 times

last updated: 16 Dec '18, 09:15