Avoid if statements for checking neighboring indexes in a 2D array
kerdemdemir via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jul 17 05:37:23 PDT 2017
> As for the problem itself, it can be solved without finding
> connected components. I won't post the solution right away
> because it is potentially a spoiler. See
> http://codeforces.com/blog/entry/53268 for problem analysis
> (828B) and
> http://codeforces.com/contest/828/submission/28637184 for an
> example implementation in D.
>
> Ivan Kazmenko.
Wow I understand the question wrongly than,
WWWWB
WWWWW
WWWBB
WWBWW
I excepted there should be two B squares here.
One 3*3 and another 1*1.
And my answer would be 6 instead 12 here.
Yes if there can be only one black square than my solution would
be much more simple.
One good thing about D community is when I ask a question here
you guys are really nice that I get inspired.
Thanks Ivan
More information about the Digitalmars-d-learn
mailing list