Help in AtCoder DP Problem of AtCoder Typical DP contest

The problem C-TOURNAMENT(Typical DP Contest) , (Use Google Translate as the problem is in Japanese). Any help is appreciated.