My solution seems easier.. I have only n+m+2 vertices, and the i'th device is connected to the j'th plug with a 1-capacity edge only if we can connect the two, using any kind of adapter.
I can't find out what's wrong... Let's say we have a total of nrrec plugs or receptacles. While reading the input data I always check if the plug has been read before. If not, I increase nrrec and add it. For each of the m devices I have ptr - the number of the plug / receptacle of the i'th device ...
Thanks about the advice... I thought about something like this but the graph already has 2.500 nodes, and the length of the source is already... big. :D I don't know if I can write the code with your advice... if I do write it I don't know if I can debug it... and if I debug it I don't know if it ...
IMO max flow kicks ass :lol: so I started to solve this problems. I didn't have any trouble solving Software Allocation, but I haven't solved #563 Crimewave yet.
First I thought that there will be a graph with s*a vertices, the source will be connected to the banks and the vertices on the border ...