#C4911. Calculate Running Statistics

    ID: 48502 Type: Default 1000ms 256MiB

Calculate Running Statistics

Calculate Running Statistics

You are given a running schedule that spans n days. For each day, you are provided with two integers: the distance that Tom plans to run and the corresponding elevation change. Your task is to compute the total distance run over all days and determine whether the total elevation change is non-negative.

Mathematically, if the distances are \(d_1, d_2, \dots, d_n\) and the elevation changes are \(e_1, e_2, \dots, e_n\), then you should calculate:

[ \text{Total Distance} = \sum_{i=1}^{n} d_i ] [ \text{Total Elevation} = \sum_{i=1}^{n} e_i ]

The output should be the total distance followed by a boolean value (printed as True or False) indicating whether \(\text{Total Elevation} \ge 0\).

inputFormat

The input is read from stdin and consists of three lines:

  1. The first line contains a single integer n indicating the number of days.
  2. The second line contains n space-separated integers representing the running distances for each day.
  3. The third line contains n space-separated integers representing the elevation changes for each day.

outputFormat

Output to stdout a single line with two values: the total distance run and a boolean value (True or False) indicating whether the total elevation change is non-negative. The two outputs should be separated by a space.## sample

5
10 20 15 25 30
10 -5 20 -10 5
100 True