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

×

Doubt in AEHASH

In this problem why they have taken max(V1, V2) = V - A ? I tried understanding but in vain. Can someone explain ?

asked 18 Jun '17, 02:12

adecemberguy's gravatar image

4★adecemberguy
725
accept rate: 16%


I think its just a simple re-arrangement.

I mean, V= result (variable returned by function)

And-

result = result + max(hash(S1), hash(S2))

But before this, result =A (we defined it such)

==> Result = A+max(v1,v2)

==>V=A+max(v1,v2)

Hence, max(v1,v2)=V-A.

They just shuffled the terms here and there. That editorial was kinda hard to understand...idk if its because of my sleepiness atm or what.

link

answered 18 Jun '17, 02:30

vijju123's gravatar image

5★vijju123 ♦
13.1k1730
accept rate: 19%

perfect...

(18 Jun '17, 02:35) adecemberguy4★
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:

×1,671
×4

question asked: 18 Jun '17, 02:12

question was seen: 113 times

last updated: 18 Jun '17, 02:35