Rosetta Problems

Jewel Necklace

https://atcoder.jp/contests/awc0083/tasks/awc0083_e