hdu 1027 Ignatius and the Princess II(next_permutation())

NoSuchKey