CCC '16 S2 - Tandem Bicycle


Submit solution

Points: 1
Time limit: 2.0s
Memory limit: 256M

Problem types
Allowed languages
C++, Python
Pair the citizen from Dmojistan with speed \(4\) and the citizen from Pegland with speed \(4\) .

Sample Input 2

2
3
5 1 4
6 2 4

Output for Sample Input 2

15

Explanation for Output for Sample Input 2

There are multiple possible optimal solutions. Here is one optimal solution:

  • Pair the citizen from Dmojistan with speed \(5\) and the citizen from Pegland with speed \(2\) .
  • Pair the citizen from Dmojistan with speed \(1\) and the citizen from Pegland with speed \(6\) .
  • Pair the citizen from Dmojistan with speed \(4\) and the citizen from Pegland with speed \(4\) .

Sample Input 3

2
5
202 177 189 589 102
17 78 1 496 540

Output for Sample Input 3

2016

Explanation for Output for Sample Input 3

There are multiple possible optimal solutions. Here is one optimal solution:

  • Pair the citizen from Dmojistan with speed \(202\) and the citizen from Pegland with speed \(1\) .
  • Pair the citizen from Dmojistan with speed \(177\) and the citizen from Pegland with speed \(540\) .
  • Pair the citizen from Dmojistan with speed \(189\) and the citizen from Pegland with speed \(17\) .
  • Pair the citizen from Dmojistan with speed \(589\) and the citizen from Pegland with speed \(78\) .
  • Pair the citizen from Dmojistan with speed \(102\) and the citizen from Pegland with speed \(496\) .

This sum yields \(202+540+189+589+496=2016\) .


Comments

There are no comments at the moment.