Anastasia and pebbles

题意翻译

题目描述 安娜斯塔西娅喜欢去乌日扬迪安中央公园散步。 但她对简单的散步不感兴趣,于是她开始收集公园里的鹅卵石。 一开始,她决定收集所有她能在公园里找到的鹅卵石。 她只有两个口袋。 她能在每个口袋里同时放最多k个鹅卵石。第i种鹅卵石有w[i]个。 安娜斯塔西娅很有责任感,所以她从不把不同类型的鹅卵石混在一个口袋里。 然而,她可以把不同种类的鹅卵石放在不同的口袋。 不幸的是,她不能把所有的时间都花在收集鹅卵石上,所以她每天只能从公园里收集一次鹅卵石。 考虑到安娜斯塔西娅不能把不同类型的鹅卵石放在同一个口袋里,请帮助她找到收集乌日扬甸中央公园所有鹅卵石所需的最短天数。 输入: 第一行两个整数n、k。第二行n个整数分别为w[i]。 输出: 一个整数t,为收集完所有鹅卵石的最少天数。 说明: 1<=n<=100000;1<=k<=1000000000; 1<=w[i]<=10000

题目描述

Anastasia loves going for a walk in Central Uzhlyandian Park. But she became uninterested in simple walking, so she began to collect Uzhlyandian pebbles. At first, she decided to collect all the pebbles she could find in the park. She has only two pockets. She can put at most $ k $ pebbles in each pocket at the same time. There are $ n $ different pebble types in the park, and there are $ w_{i} $ pebbles of the $ i $ -th type. Anastasia is very responsible, so she never mixes pebbles of different types in same pocket. However, she can put different kinds of pebbles in different pockets at the same time. Unfortunately, she can't spend all her time collecting pebbles, so she can collect pebbles from the park only once a day. Help her to find the minimum number of days needed to collect all the pebbles of Uzhlyandian Central Park, taking into consideration that Anastasia can't place pebbles of different types in same pocket.

输入输出格式

输入格式


The first line contains two integers $ n $ and $ k $ ( $ 1<=n<=10^{5} $ , $ 1<=k<=10^{9} $ ) — the number of different pebble types and number of pebbles Anastasia can place in one pocket. The second line contains $ n $ integers $ w_{1},w_{2},...,w_{n} $ ( $ 1<=w_{i}<=10^{4} $ ) — number of pebbles of each type.

输出格式


The only line of output contains one integer — the minimum number of days Anastasia needs to collect all the pebbles.

输入输出样例

输入样例 #1

3 2
2 3 4

输出样例 #1

3

输入样例 #2

5 4
3 1 8 9 7

输出样例 #2

5

说明

In the first sample case, Anastasia can collect all pebbles of the first type on the first day, of second type — on the second day, and of third type — on the third day. Optimal sequence of actions in the second sample case: - In the first day Anastasia collects $ 8 $ pebbles of the third type. - In the second day she collects $ 8 $ pebbles of the fourth type. - In the third day she collects $ 3 $ pebbles of the first type and $ 1 $ pebble of the fourth type. - In the fourth day she collects $ 7 $ pebbles of the fifth type. - In the fifth day she collects $ 1 $ pebble of the second type.