To minimize total speed: Pair riders with similar speeds. Sort both arrays ascending and match by position.
Why? When two fast riders are paired, only one counts (the faster). You "hide" one fast rider's speed behind another.
Example: red = [5, 3, 1], blue = [4, 2, 0]. Pair: (1,0), (3,2), (5,4). Speeds: , , . Total: . This approach wastes as many fast riders as possible by pairing them together. Sort both arrays the same direction and match positions.