Let's discuss problems here.
It would be interesting to hear some good solutions for C and D.
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
Let's discuss problems here.
It would be interesting to hear some good solutions for C and D.
Название |
---|
To us, C was very tough to code. So we just tried to place say around 2k house+garden and every time we randomly picked (r, c) for anchor and random orientation of house+garden. It gave us around 600+ score.
I would be interested to hear about B
A: some matrix exponentiation
B: sort the segments by their right border, then choose them greedily
These were ACM-style tasks. We got 12th place in C by the following algorithm:
D was completely written by Slamur and craus, I don't know about their algorithm, but they managed to get the 2nd place in 7th test, and the 6th place in total.
ehm.
How can you solve B like this on sample test case?
(I sorted segments for you).
We got 5th place with D. It was about 2 hour coding and 2 hour calibration to maximise score. The idea is to concentrate on minimising K. Sort all cities by the end of the time interval. Visit cities in this order. For each city find if there is a car anywhere that can reach it with enough goods and take the car that is closest. If there isn't a car, then send a new car from depot. That's it. Tests were such that there weren't that many cars at any time sent from depo and it ran very quickly, without having to bound the number of cars.
Calibration. Try changing the sorting method for cities — didn't help much. Try looking ahead for cities, rather then just taking the next one. Execution time was reasonable, but number of cities to look ahead had to be bounded to about a 100. Take the minimim distance from all combinations of car — city mapping. From here you could further see a number of ways to optimise in addition to what we tried.
We have also written a more optimal solution, but less efficient. It gave better answer for the first 2 tests. We finished 9th overall.
Problem D by Charles University Legion (1st place):
Build initial solution (similarly to problem B):
Iterate:
Step 2. is also called on the best solution found so far.
Insert some random decisions into the above algorithm and run it thousands of times.
Profit!
D (2nd place) with a simple solution:
Initialize with a simple solution — one vehicle to one client.
Till the end of time do a hill climbing. The state is a path for each vehicle. There are 4 transition functions: (1) swap within single path (2) reverse within single path (3) swap in two paths (4) move one client to a different path and destroy the path if it's empty. Accept move if it increases the score or with some small probability.
The last thing was an addition of a special "move" that tries to remove a path (vehicle), and distributes the clients to the remaining vehicles. I think we would still have the 2nd place without this, but only due to big margin between 2nd & 3rd place.
Probably the most important idea was the loading of the current solution. I didn't optimize the code at all (lot's of pointless memory allocations, etc.) and it took really long (around 1h) to get a decent solution on bigger tests. That way I could tweak some stuff without having to start from scratch.
Is reversing a path helping anything? Time intervals are pretty short, so it is very likely that we won't be able to reverse a path consisting of >=2 vertices (and of course reversing path with 1 vertex is doing nothing).
What do you mean by "the loading of the current solution."? I didn't get it.
And one more additional question just out of curiosty — how big were ratios c/k and t0/t in your solutions?
Is reversing a path helping anything? Time intervals are pretty short, so it is very likely that we won't be able to reverse a path consisting of >=2 vertices (and of course reversing path with 1 vertex is doing nothing).
Probably doesn't do anything (due to time intervals as you mentioned, but I didn't really look at the tests during the contest). Actually it's >= 4, since lengths 2 & 3 are handled by a single swap.
What do you mean by "the loading of the current solution."? I didn't get it.
I'm saving my best solution every second or so. When I kill my program, I can start my (new) program from my last solution.
I'm pasting top line from my solutions (i.e. number of vehicles & fuel consumption). The first two doesn't correspond with my best submission:
In general, the priority was to minimize the number of vehicles, since minimizing fuel consumption was somewhat independent of vehicle number. The only problem was that the tempo of reducing the fuel consumption was lower (in case of my algo), when you had fewer redundant vehicles.
We used a simple greedy approach in problem C: find a position+orientation for pair house+garden which gives the most points, fix these house+garden at the position; then find the best position for another pair house+garden (including that we have already pasted previous pairs) and so on while the bonus from new house is positive. It gave 3rd-5th places for most test before the frozing. A way to improve it: try to remove one pair house+garden and place another pair (with probably better result) on the field and repeat such operations while possible. This increases result only by 2-5% but it was enough to be placed 1st-2nd on the big tests (5-10) at the final scoreboard, 997 points in total.
Who the hell came up with an idea of making time negative in B :P? That is so wrong, I wasted more time in finding that than actually solving the problem :P.