#P6481. [CRCI2006-2007] FIREFLY

[CRCI2006-2007] FIREFLY

Background

A Japanese firefly flies into a cave full of obstacles.

Problem Description

There are two kinds of obstacles in the cave: stalagmites (growing upward from the ground) and stalactites (hanging down from the ceiling). The cave is nn units long and hh units high. From left to right, the first obstacle is a stalagmite; then stalactites and stalagmites appear alternately.

The picture below shows an example cave with length 1414 units and height 55 units:

This Japanese firefly will not avoid obstacles. It only flies at a fixed height. With its superb skills, it can start from one end of the cave and, at some height, break through all obstacles to reach the other end.

For example, in the picture above, if the firefly chooses height 44 to fly, it will hit a total of 88 obstacles.

But this is not the best choice. Because if it flies at height 11 or height 55, it only needs to break through 77 obstacles.

To reduce the pain, you need to help the firefly find the minimum number of obstacles it must destroy, and how many different heights achieve this minimum.

Input Format

The first line contains two integers n,hn, h, representing the length and height of the cave. The testdata guarantees that nn is even.

The next nn lines each contain one integer, representing the length of an obstacle. It is guaranteed that all obstacle lengths are less than hh.

Output Format

Output one line with two integers: the minimum number of obstacles that must be destroyed, and the number of different height choices that achieve this minimum.

6 7
1
5
3
3
5
1
2 3
14 5
1
3
4
2
2
4
3
4
3
3
3
2
3
3
7 2

Hint

Constraints

For 100%100\% of the testdata, it is guaranteed that 2n2×1052 \le n \le 2 \times 10^5 and 2h5×1052 \le h \le 5 \times 10^5.

Notes

Translated from COCI2006-2007 Regional Competition T3 FIREFLY

Translated by ChatGPT 5