This page is still under construction.

Parts of this page are still being built. What you see may change.

Football

Time limit1sMemory limit1024 MB

Summary
Split a row of N player skills into K consecutive segments of at least M each so that the minimum segment average is maximized, and print that value as a reduced fraction.
Level

Hard8 of 10

Topics
Binary search, Dynamic programming, Prefix sum, Greedy
Solved
No attempts yet

Problem

Every year, student sports competitions are held in Byteland. Football is especially popular and is played by NN students; the skill of student ii as a footballer is given by the integer AiA_i.

For the tournament, KK teams must be formed, and every team must have at least MM players. The strength of a team is the arithmetic mean of the skills of its members. For example, if a team has players with skills 11, 55, 44 and 99, then the strength of that team is 1+5+4+94=4.75\frac{1+5+4+9}{4} = 4.75.

The coach wrote all players' skills on paper in a single row. He now wants to split this row into KK segments so that each segment contains at least MM numbers. He then forms one team from the players in each segment. To make the tournament more exciting, the coach wants the strength of the weakest team to be as large as possible.

For example, if the players' skills in order are 55, 44, 44, 33, 55, 11 and 88, and two teams must be formed with at least three players each, the coach has two options:

  • put the players with skills 55, 44, 44 in the first team and 33, 55, 11, 88 in the second team;
  • put the players with skills 55, 44, 44, 33 in the first team and 55, 11, 88 in the second team.

In the first case the strength of the weaker team is 174=4.25\frac{17}{4}=4.25; in the second case it is 44. So the coach chooses the first option.

Write a program that, for the given players, determines the largest possible strength of the weakest team.

Input

The first line contains three space-separated integers NN, MM and KK (6≤N≤1046 \le N \le 10^4, 2≤M2 \le M, 2≤K≤5002 \le K \le 500, K⋅M≤NK \cdot M \le N): the number of players, the minimum required team size, and the number of teams to form, respectively.

The second line contains NN space-separated integers AiA_i (1≤Ai≤1091 \le A_i \le 10^9): the players' skills, in order.

Output

Divide the players, in the given order, into KK consecutive teams of at least MM players each. Print, on a single line, the largest possible strength of the weakest team as a reduced fraction p/qp/q (in lowest terms, with denominator q≥1q \ge 1). If the value is an integer vv, print it as v/1v/1.

Examples2

  1. Example 1

    Input
    7 3 2
    5 4 4 3 5 1 8
    
    Expected output
    17/4
    
  2. Example 2

    Input
    8 2 3
    1 1 1 1 1 1 1 1
    
    Expected output
    1/1