How to solve IZHO 2017 Bomb? Please help! Problem link: https://oj.uz/problem/view/IZhO17_bomb
# | User | Rating |
---|---|---|
1 | ecnerwala | 3649 |
2 | Benq | 3581 |
3 | orzdevinwang | 3570 |
4 | Geothermal | 3569 |
4 | cnnfls_csy | 3569 |
6 | tourist | 3565 |
7 | maroonrk | 3531 |
8 | Radewoosh | 3521 |
9 | Um_nik | 3482 |
10 | jiangly | 3468 |
# | User | Contrib. |
---|---|---|
1 | maomao90 | 174 |
2 | awoo | 164 |
3 | adamant | 162 |
4 | TheScrasse | 159 |
5 | nor | 158 |
6 | maroonrk | 156 |
7 | -is-this-fft- | 151 |
8 | SecondThread | 147 |
9 | orz | 146 |
10 | pajenegod | 145 |
How to solve IZHO 2017 Bomb? Please help! Problem link: https://oj.uz/problem/view/IZhO17_bomb
Name |
---|
Nvm this, it's wrong!
Thanks! I wrote what you said but is gets only 24 score. Code: https://oj.uz/submission/171777 I can not catch any bug in this code.
Your solution is wrong. Here's a counterexample
We can't fill it with 3x3 bombs.
P.S. I don't know the full solution, but enoone and DavitMarg do.
Maybe they want some contrtibution.Obviously the width is bounded by the smallest horizontal strip of 1s, let that width be w.
Let's precalculate top[i][j] = greatest x<i such that (x, j) is 0, precalculate bottom[i][j] similarly.
Create an array h of size w, all initialized to the smallest vertical strip of 1s.
For each maximal horizontal strip of 1s from (i, l) to (i, r) do the following:
For each prefix of that strip from (i, l) to (i, x), min h[x-l+1] with (y = min(bottom[i][l..x])-max(top[i][l..x])-1). It basically means that if we put a rectangle at [l, x], we can get a height of at most y.
Do a similar thing for all suffixes of that strip.
I claim that a rectangle of max(h[i]*i) is always possible, and you can see that this is true as the codes that do this get AC.