Side notes: I was trying to figure out how a solution was very faster than mine. However, it turns out that solution was wrong (using pascal's string to read input instead of ansistring ) but still passed a special test case. So funny. When I corrected that solution, it was no better than mine.
Some notes on implementing Maximum Flow:
Use some wrapper ID functions to make the code readable and less exposed to errors:
int idSource() {return 0;}
int idTarget() {return n+m+1;}
int idPerson(int i) {return 1+i;}
int idGroup(int i) {return 1+n+i;}
No comments:
Post a Comment