#465
Unrated
Berry Picking
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Bessie and her little sister Elsie are picking berries in Farmer John's berry patch. Farmer John's patch has exactly NN berry trees (1N10001\le N\le 1000); tree ii contains exactly BiB_i berries (1Bi10001\le B_i\le 1000). Bessie has exactly KK baskets (1K10001 \le K \le 1000, KK even). Each basket can hold as many berries from a single tree as Bessie wants, but cannot contain berries from two different trees as their flavors will clash with each other. Baskets may remain empty.

Bessie wants to maximize the number of berries she collects. However, Farmer John wants Bessie to share with her little sister, and so Bessie will have to give Elsie the K/2K/2 baskets with the largest number of berries. This means that Elsie may even end up with more berries than Bessie, which is very unfair, but unfortunately, sibling dynamics are not always fair.

Help Bessie figure out the maximum number of berries she can collect.

SCORING: Test cases 1-4 satisfy K10.K\le 10.Test cases 5-11 satisfy no additional constraints.

입력

The first line of input contains space-separated integers NN and KK.

The second line contains NN space-separated integers B1,B2,,BN.B_1,B_2,\ldots,B_N.

출력

A single line with the answer.

예제 입력 1

5 4
3 6 8 4 2

예제 출력 1

8
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.