Codeforces Round #181 Problem E Empire Strikes Back