PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000298. Bìa cứng cho tranh (Cardboard for Pictures)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Bìa cứng cho tranh (Cardboard for Pictures)

Cardboard for Pictures

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn square pictures, with side lengths sis_i cm. Each is mounted on square cardboard with a uniform border of width ww cm on every side, including cardboard behind the picture. The total cardboard area is cc square cm. A positive integer ww is guaranteed to exist; find it.

Input

First line: n,cn,c. Second line: nn integers sis_i.

Output

Print the positive integer ww.

Subtasks

  • Subtask 1 (20 points): 1≤n≤301\le n\le30; 1≤c≤1061\le c\le10^6; 1≤si≤1001\le s_i\le100; a positive integer solution ww exists.
  • Subtask 2 (30 points): 1≤n≤2⋅1051\le n\le2\cdot10^5; 1≤c≤10181\le c\le10^{18}; 1≤si≤1041\le s_i\le10^4; s1=⋯=sns_1=\cdots=s_n; a positive integer solution ww exists.
  • Subtask 3 (50 points): 1≤n≤2⋅1051\le n\le2\cdot10^5; 1≤c≤10181\le c\le10^{18}; 1≤si≤1041\le s_i\le10^4; a positive integer solution ww exists.

Examples

Input 1

3 50
3 2 1

Output 1

1

Explanation

Cardboard sides are 5,4,3; the total area is 25+16+9=50.

Input 2

1 100
6

Output 2

2

Explanation

The cardboard side is 6+2×2=10.