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

×

SIMBABY - Editorial

PROBLEM LINK:

Contest

Author: Shivank Pathak

Editorialist: Shivank Pathak

DIFFICULTY:

EASY

PREREQUISITES:

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

shivank01's gravatar image

4★shivank01
11
accept rate: 0%

edited 16 Dec '18, 09:15

admin's gravatar image

0★admin ♦♦
19.7k350498541

toggle preview
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • 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,482
×3,706
×864
×13

question asked: 15 Dec '18, 19:16

question was seen: 60 times

last updated: 16 Dec '18, 09:15