The PDF version of this problem can be downloaded here. Warn: 本題有 checker
Migrated from old NTUJ.
JAG Practice Contest for ACM-ICPC Asia Regional 2017, AtCoder, 2017–09–24