#C3317. Minimum Railway Car Trips

    ID: 46731 Type: Default 1000ms 256MiB

Minimum Railway Car Trips

Minimum Railway Car Trips

You are given a railway car that can carry at most k passengers per trip. There are n stations. At the starting station, a group of passengers is ready to board the car. The number of passengers waiting at each station is given in an array. Although a corresponding array of destination station numbers is provided, the current task is to determine how many trips are needed to transport all passengers from the starting station. The answer is the ceiling of the total number of passengers divided by k.

Note: Even though the destination array is provided for realism, only the starting numbers affect the computation.

The mathematical formulation for the number of trips is:

\[ \text{trips} = \left\lceil \frac{\text{total passengers}}{k} \right\rceil \]

inputFormat

The input is read from stdin and has the following format:

  • The first line contains two integers n and k — the number of stations and the capacity of the car.
  • The second line contains n space-separated integers representing passengers_start, the number of passengers waiting at each station.
  • The third line contains n space-separated integers representing passengers_dest. (This array does not affect the computation.)

outputFormat

Output a single integer to stdout representing the minimum number of trips needed to transport all passengers.

## sample
3 6
5 8 3
7 5 4
3