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

×

Doubt in explaination -ONEKING

What happens if there are many kingdoms within a bigger kingdom say [1,9],[1,4],[5,6],[7,9]?what will be the number of bombs required.

1 bomb or 3 bombs ?

asked 05 Jan '15, 18:15

rahul_mishra01's gravatar image

2★rahul_mishra01
8727
accept rate: 0%

edited 12 Jan '15, 15:12

admin's gravatar image

0★admin ♦♦
18.5k348495529


I think, that problem statement is clear:

A kingdom of the form [L, R] can be destroyed completely by placing a bomb at a point x on the real line if L ≤ x ≤ R.

so can you destroy [1, 4] and [5, 6] with one bomb?

Apply golden rule: Do not assume something not written in problem statement.

link

answered 05 Jan '15, 18:30

betlista's gravatar image

3★betlista ♦♦
16.9k49115225
accept rate: 11%

I had similar doubt (except the examples).
Thanks you very much @betlista ♦♦ for clearing it up, finally got AC :) .
Thanks again.

(05 Jan '15, 19:15) mediocoder3★

i think the intervals which overlap at some point can be destroyed by 1 bomb but which do not overlap have to be destroyed with another bomb.

link

answered 05 Jan '15, 20:11

zebronic's gravatar image

1★zebronic
174
accept rate: 0%

But can't we destroy all kingdoms with a single bomb by destroying 1st kingdom i.e. [1 to 9] ? And answer of above test case should be 1 .Am i wrong in getting the problem .

link

answered 05 Jan '15, 19:54

vinitpayal's gravatar image

3★vinitpayal
153
accept rate: 0%

Why should it work that way? There's nothing like that written in problem statement, those are separate kingdoms...

(05 Jan '15, 20:08) betlista ♦♦3★

But 1 to 9 kingdom will be overlapped by all other kingdoms so if we will destroy it all other kingdoms should be destroyed .....

link

answered 05 Jan '15, 21:00

vinitpayal's gravatar image

3★vinitpayal
153
accept rate: 0%

Back to the basics. Tell me, where you will place the bomb...

(05 Jan '15, 21:30) betlista ♦♦3★

Try out this simple thing.

  1. Draw a real line.
  2. Find the overlapping regions.

Gives you 3.

link

answered 05 Jan '15, 22:42

xiaoyu_02's gravatar image

2★xiaoyu_02
5531922
accept rate: 5%

ofcourse 3 bombs will be required

link

answered 06 Jan '15, 00:59

shankar96's gravatar image

3★shankar96
1
accept rate: 0%

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:

×249
×33

question asked: 05 Jan '15, 18:15

question was seen: 2,850 times

last updated: 12 Jan '15, 15:12