全探索は競プロの基本だゾ今回の提出: https://atcoder.jp/contests/abc194/submissions/23133226
http://www.nicovideo.jp/watch/sm38829893