import java.io.*; import java.util.*; /** * You Win (aka Western Union), ACM ICPC SER 2013 (02.nov.2013) * * @author john brodie * */ public class YouWin_jbrodie { private static final int MAX = 20; private static int[][] memo = new int[1< last, count the number of // 1's in our mask between last and next (not including the one at // last). // // when moving to the left, e.g. next < last, count the number of // 1's between and this time include the one at last. private static int position(int mask, int last, int next) { int count = 0; int from, to; if( next < last ) { for(int i = next; i <= last; ++i) { if( (mask & (1<