You'll want to spend your effort going uphill.
I'll explain using an example. The numbers are made up, but calculated according to real-life principles and laws.
Assume a course 10 km long. The first 3 km are flat. The next 2 km are uphill at a 6% grade. After that, 2 km downhill at 6%. Finally 3 km flat.
Our fictional rider has a constant 200 W at his disposal.
For the first flat part, this gives a speed of 31.1 km/h for this fictional rider. The 3 km takes 5 m 47 s.
Our rider hits the hill, and his speed drops to 13.5 km/h. The hill is eaten up in 8 m 52 s.
Passing the summit, the speed instantly increases to 53.5 km/h. Time downhill is 2 min 15 s.
The final flat part is equal to the first.
Total time, then, is 22 m 41 s. Much of that time is spent going uphill.
Let's say our rider coasts downhill instead, but rides the same way on the flats and uphill. He still rolls downhill at 46.2 km/h and takes 2 m 36 s to do so. The course then takes 21 seconds longer to complete.
Now we give our rider 100 W extra to spend on either one flat part, the uphill part or the downhill part.
If the 100 W is spent on one flat part, the total time decreases by 50 s to 21 m 51 s.
Spent going uphill, time decreases by 2 m 35 s, for a total time of 20 m 6 s.
Downhill at 300 W instead of 200 W, time saved is only 7 s! Total time becomes 22 m 34 s.
I'd guess that in the above example, the rider could avoid losing those 7 s downhill by coasting and going into an "aero tuck".