Rosetta Problems

Jewels

https://atcoder.jp/contests/nikkei2019-qual/tasks/nikkei2019_qual_f