This problem is in Contest(s) below:
Contest 1035:컴퓨터알고리즘 중간 과제용 콘테스트