UVa 507 — Jill Rides Again

于子軒
1 min readDec 25, 2017

--

507 — Jill Rides Again

PDF

Solution

Maximum Subarray

Be careful of the problem description

If more than one segment is maximally nice, choose the one with the longest cycle ride (largest j − i).
To break ties in longest maximal segments, choose the segment that begins with the earliest stop (lowest i).

Carefully set your condition

(sum > mx || (sum == mx && i+1-start > final_end - final_start)

code

Originally published at geniustanley.github.io on December 25, 2017.

--

--

于子軒

我想寫帥氣又厭世的自介但寫不出來https://geniustanley.github.io/