|
|
back to boardTests must be improved Posted by raggzy 24 Nov 2013 22:00 The next 2^N worst-case algo gets AC. searchSolution(i) { if (i==N+1) { throw new FoundException(); } group[i] = 1; if (checkThisAndAdvsHasNotMoreThan1Adv(i)) { searchSolution(i+1); } group[i] = 2; if (checkThisAndAdvsHasNotMoreThan1Adv(i)) { searchSolution(i+1); } group[i] = 0; } ............ try { searchSolution(1); } catch (FoundException e) { outputResult(); } output("NO SOLUTION"); Judges, please do something with it :) This is cool graph problem, i think in order to get AC one should write O(N) solution :) But this obvious brute-force gets AC SAD :( |
|
|