|
|
back to boardShow all messages Hide all messagesI've AC but I can't undestand how prove that GCD gives right answer? Come ON! Please I want to know Every stone may go to positions pos+K*x, pos - its original place, x - some integer, K - sought value. If for every stone its designated position is reachable (i.e. K divides abs(dst-src)), then stones are sortable - just bubble-sort each of K chains, and they are not sortable otherwise. So, the answer is GCD(dst-src) for all stones. Edited by author 06.08.2008 16:12 |
|
|