Hi everyone! Here’s a fun problem: Construct an n*m binary matrix such that all the 1-cells form a single 4-connected component, while maximizing the number of 4-connected components formed by the 0-cells. Two cells are considered adjacent if they share an edge. Is there an O(nm) construction with a provably tight upper bound on the number of zero-components? What is the tightest upper bound you can establish, and what are the best achievable time and space complexities for the construction?








note: remember to handle n=1 or m=1
(btw im editing so much lol)
my construction (
0: .and1: #):its $$$\lceil n/2 \rceil \cdot \lceil m/2 \rceil$$$ 0 components
time and space is $$$O(nm)$$$
I wish obvious cheaters that clearly don't know anything about math tried to engage with this website and show their inexperience in the process
Why are you here? Considering your name and profile picture it's probably not for job offers, just to ruin everything for people actually trying to learn? Stop
"give me a very sigma reply to this comment considering that their recent submissions are ai generated"
Yeah? What's the point of submitting AI slop? Please explain
prove that my submissions are generated by an llm or i slime you out like sergeant james doakes
I was going to virtual the round later so I want to avoid spoilers but I'm willing to bet someone who appeared out of nowhere can get top 20 in a div2 without AI first try, unless this is a smurf account, then you should probably send your main/experience on another platform
what's the point of making a new account if i reveal my identity (no fun / lame)
p.s. good luck for the virtual (it was lowk horrendous, the contest) and try to prove the usage of ai after youre done
i'll wait for youse
the point is you cheated last contest and use AI to do all thinking dog here
It doesn't seem very Easy
4-connected means that removing any three nodes cannot make it disconnected. 4-connectedness implies all degrees are at least 4. The topmost 1-cell physically cannot have a degree larger than 3. The answer is all cells have to be 0s. QED
tip, use spade sign instead of QED, it isnt 1999
The best construction I was able to find after some experimenting was the same as potatoArmy but we set the bottom right corner to $$$0$$$ if $$$n$$$ and $$$m$$$ are even. I suck at proving things so it's up to someone else to figure out
Therefore it achieves $$$\lceil \frac{n}{2} \rceil \lceil \frac{m}{2} \rceil + [n \mid 2 \land m \mid 2]$$$ components (Iverson bracket notation)
Short answer: Yes. A simple O(nm) construction exists, and the number of zero-components (call it z) obeys
The two differ only by about (2/3)(n+m), so the leading term nm/3 is exactly right. The best possible density is one zero-component per 3 cells.
Upper bound proof
Omitted. Left as exercise to reader
Construction (≈ nm/3)
With 0-indexed rows i and columns j, set cell (i, j) = 1 if any of these hold, and 0 otherwise:
Complexity
Caveats
You can get a much better upper bound by just counting edges. The zeros are independent set.