Help on set problem

Revision en1, by MutedSolace, 2024-06-20 01:09:23

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!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English MutedSolace 2024-06-20 01:09:23 2528 Initial revision (published)