Water Journal

시간 제한1초메모리 제한2048 MB

요약
n, 최솟값 a, 최댓값 b와 n-1개의 기록이 주어질 때 빠진 하루의 값이 될 수 있는 모든 수를 출력하거나 -1을 출력한다.
난이도

쉬움10점 중 2점

유형
배열, 구현
정답자
아직 제출이 없습니다

문제

Every day, Eugene logs how many cups of water he drank. He forgot to log one entry in his journal though, but he remembers the minimum number and maximum number of cups of water he drank every day since he started logging his journal, and that there was at least one day where he drank the minimum and one day where he drank the maximum. Compute all possible amounts of cups of water he could have imbibed on the day he forgot to log.

입력

The first line of input contains three integers nn (2≤n≤502 \le n \le 50), aa and bb (1≤a≤b≤501 \le a \le b \le 50), where nn is the number of days in Eugene's log, aa is the minimum number of cups of water he drank on any day, and bb is the associated maximum.

Each of the next n−1n-1 lines contains a single integers ww (a≤w≤ba \le w \le b). These are the entries in Eugene's log for every day except the day he forgot to log an entry.

출력

Output in increasing order, all of the possible values for the missing entry separated by whitespace, or simply output -1 if Eugene's memory is faulty and it isn't possible.

예제2

  1. 예제 1

    입력
    5 1 5
    1
    2
    4
    5
    
    예상 출력
    1
    2
    3
    4
    5
    
  2. 예제 2

    입력
    5 1 5
    1
    2
    3
    4
    
    예상 출력
    5