problem link: https://open.kattis.com/problems/illumination
I think this problem simplifies down to putting k elements into 2 sets given conditions in the format of either:
1. x and y cannot both be in set 1
2. x and y cannot both be in set 2
where set 1 represents lamps oriented vertically and set 2 represents lamps oriented horizontally.
So far I have tried a bfs bipartite-like approach but it's getting WA on TC 9/43:
My Code
Any help would be appreciated!