EPIJudge icon indicating copy to clipboard operation
EPIJudge copied to clipboard

Draw the skyline problem incorrect test case

Open zorro786 opened this issue 5 years ago • 5 comments

The input to first test case contains the array [10, 85, 84]

The expected result contains: .....[17, 24, 98], [25, 29, 84]....

It shows 24 - 25 as disjoint when it should have been [24, 25, 84] (or merged with other intervals)

zorro786 avatar Jan 26 '20 22:01 zorro786

There is no problem here since the interval is inclusive. [17, 24, 98] means the skyline from 17.0 to 24.9999 are in height 98. You could take a look of solution to understand why this works as well.

tsunghsienlee avatar Jan 27 '20 03:01 tsunghsienlee

@tsunghsienlee Doesn't inclusive interval [17, 24] mean 17.0000 -> 24.0000 ?

zorro786 avatar Jan 27 '20 06:01 zorro786

I think the inclusive probably is not the best wording here. You could think each coordinate (i.e., 17, 24) is a single unit (look at the bar in the picture). So the interval between 17 and 18 does not matter. That is the reason the result is in this way. I think the problem description might need more example on explaining this.

tsunghsienlee avatar Jan 27 '20 06:01 tsunghsienlee

I see so the output expectation is different. It would be really helpful if an example input/output is provided in question text. Because in merging intervals problem earlier the expectation of output is very different (similar to how I interpreted for this question), so it may not be easily evident.

zorro786 avatar Jan 27 '20 06:01 zorro786

Hi @zorro786 ,

After examining this more, I think the output format definitely needs improvements and there are bugs in the corner cases that it will be released in the next release. Thanks for bring this up and catch our attention.

tsunghsienlee avatar Feb 17 '20 01:02 tsunghsienlee