Блог пользователя sillycross

Автор sillycross, 11 лет назад, По-английски

I doubt whether the standard solution for problem E is correct.

The problem is: when two center's distance is smaller than 2R, the two circles may still be separated on the grid matrix.

Consider the following case:

Circle 1: center (0,0) radius 14

Circle 2: center (20,19) radius 14

The eculid distance between center is , which is less than 28.

However, the 2 circles do not intersect on a grid matrix, since no integer coodinate falls on their intersection area. So the 2 circles are still valid solution.

But it seems that the standard solution did not consider this special case. I (and many others) got wa on test 20. After I changed the intersect checking to "center distance<=2R" it got accepted.

solution: http://codeforces.me/contest/363/submission/5067126 notice the quoted code between line 77 and 82. after removing these codes the solution got WA.

A possibly wrong test case for the std solution: http://paste.ubuntu.com/6399141/

  • Проголосовать: нравится
  • +16
  • Проголосовать: не нравится

»
11 лет назад, # |
  Проголосовать: нравится +13 Проголосовать: не нравится

Thanks for your post. I also have the same opinion with you on this issue (but it seems you made some typos in your reasoning). It should be when the distance between 2 centers is less than or equal 2R, the two circles may still be separated because the set of covered cells is smaller than the original circle.

»
11 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I also doubt it.

»
11 лет назад, # |
Rev. 5   Проголосовать: нравится +11 Проголосовать: не нравится

This is a simple example:

R = 2

Center 1 at (3, 3) and center 2 at (6, 5). Distance is sqrt(3 * 3 + 2 * 2) = 3.6 < 4 = 2R

..x....
.xxx...
xxxxx..
.xxxo..
..xooo.
..ooooo
...ooo.
....o..

»
11 лет назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

We are investigating the situation.