Argh! My algorithm is OK, but I've forgotten to initialize some variable in my program and that's why I was getting WA It took me two weeks to find that stupid mistake!!!
Looks like a simple bipartite matching problem, but I always get a WA reply :cry: What I'm doing is: - plugs and receptacles (verticies) together with adapters (edges) form a graph, so first I do a bsf of this graph for each device (of course, if two devices have got the same plug type I do ...