Блог пользователя MidnightCodeCup

Автор MidnightCodeCup, история, 17 месяцев назад, По-английски

The Midnight Code Cup qualification round has ended. Thanks to all participants for giving it your best!

Final rankings are here: https://ranker.codeforces.com/ranklist/602915

Problem statements and materials are available here.

As we only accepted outputs for scoring, we’d love to learn about your solution approaches – please share in the comments!

This round would not have been possible without:

Thank you all!

  • Проголосовать: нравится
  • +150
  • Проголосовать: не нравится

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится +36 Проголосовать: не нравится

Easy top1!!!

»
17 месяцев назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve C2? Tried asking LLM, but I don't find a way to make them understand the code and teach me. Is it expected that the code should be understand by a human?

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Problem A testcase 1: How is 98.736+ points possible!?

»
17 месяцев назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

Solution for C1 can be found on oeis, if you try to compute answers for 1 1 1, 2 2 2, 3 3 3, 4 4 4 input data and enter it as a sequence. Oeis link

whining

The fun part about getting partial points:

Test 1
Hint
Test 2
Test 6
Test 8

For C2, you can get 120 points by:

Spoiler
»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится +18 Проголосовать: не нравится

B1 and B2 are simple, find a way to make the solution traverse as many wrong subsets as possible (about 2^23) before finding the optimal solution:

B1:

15
1 1
...
1 1
9 10

B2 (not the optimal but almost):

65
1 1
...
1 1
50 9

But I don't understand how to make B3 larger than 2^12, can somebody share some tips?

  • »
    »
    17 месяцев назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится 0 Проголосовать: не нравится

    The knapsack problem is quite well-studied, so you may find some pointers in research papers. One particular author to note is David Pisinger, and one of his papers — with a very obvious name — lists a finite number of generators of difficult tests with small weights. Then it's up to you how to search in this space, but if you are lucky enough with the choice, even exhaustive search may bring some improvements over 2^12.

    P.S.: kudos to those who can find the real name of the algorithm behind B3.

  • »
    »
    17 месяцев назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится 0 Проголосовать: не нравится

    I claimed that $$$w_i = v_i$$$ and $$$w_1 = \cdots = w_{n-1}$$$, found a decent test case with $$$9$$$ rows and small $$$W$$$ using simulated annealing, then I generalized it to more rows.

    Before that, I tried simulated annealing with no additional constraints but it gave bad results, then I started adding constraints which seemed reasonable.

»
17 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

C1: Guessforces. By using custom invocation, you can see the result of (about) $$$A+B+C \le 6$$$.

Inputs and Outputs

Now you'll find what the task itself is, from above testcases.

step 1
step 2
The task
  • »
    »
    17 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    I simply ask Gemini to solve it, lol.

    • »
      »
      »
      17 месяцев назад, скрыть # ^ |
      Rev. 7  
      Проголосовать: нравится 0 Проголосовать: не нравится

      That's frustrating and surprising really. I performed testing with chatgpt, dozens of iterations and it seemed conclusive chatgpt shouldn't work. Example: link.. There was some additional hardening to make it unlikely to ever happen.

      However, I was also thinking that's not end of it if people find a way to game C1 by either guessforces or chatgpt or other techniques, because having C1 solved diligently gives a huge boost to solving C2 because most things are literally the same. I think solving C1 with chatgpt actually hurted people's ability to solve C2.

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится -17 Проголосовать: не нравится

MidnightCodeCup Pick me as your wildcard entry, I promise I’m just the right amount of chaos

»
17 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится +26 Проголосовать: не нравится

I can't wait for the OEIS CODE CUP world finals!!

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Thank you for the great contest, this was my first time participating in such a heuristic-ish contest and I loved every second of it!

I spent most of my time on problem A trying to deal with the IK solver, and I think I spent too much time on trying to integrate a generic one for the 3-link arm and not enough on actually working on cost optimization. I used a simulated annealing approach with two strategies randomly chosen at every step:

  1. 2-opt swapping (classic TSP strategy)
  2. parity swapping (choosing a different pair of angles for reaching a given strawberry)

And in the end I think I should've spent more time on looking at each test case more carefully to better fine-tune the strategies, especially on cases like test case 8.

  • »
    »
    17 месяцев назад, скрыть # ^ |
    Rev. 3  
    Проголосовать: нравится +10 Проголосовать: не нравится

    We just did a greedy solution instead (pick the next target so that the cost of changing the angle is minimal) and it worked pretty good. Also reused the 2-link arm solution for 3-link arms, just checking 1024 angles for the first link and then solving the rest.

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится +113 Проголосовать: не нравится

I think C1/C2 was interesting, but it was very unpleasant to have the VM in Kotlin with no prior notice of it. I don't have any Kotlin setup so I had to run it online which posed runtime and output restrictions. If it's not going to be an easily runnable language like Python, I don't see a reason not to notify people to set it up. I solved C2 about 3 minutes after the end so any slowdown definitely made a huge difference for us.

I know that it's done because Jetbrains is a sponsor, but it also sounds beneficial for them to have everyone set up a Kotlin environment. Now I will just have Kotlin nightmares instead :\

  • »
    »
    17 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится +10 Проголосовать: не нравится

    Big thumbs up for this; I have literally spent more than an hour to install all the necessary stuff (apparently I had an outdated Kotlin version or w/e and the code did not want to compile/build). Great task, but giving an example Kotlin and recommending to run it locally would be fair, imo.

  • »
    »
    17 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    The kotlin version of my local computer (a debian bookworm) is too old to run the code. After spending some time to find a way to upgrade it. I just came up that I can run the program in a docker.

    After random searching on dockerhub, I finally found this to be working.

  • »
    »
    17 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится +10 Проголосовать: не нравится

    +100 on this; I thought solving C2 20 minutes after the end was bad but I see it could have been way worse... I'm also fairly sure it took me longer than that to run the provided Kotlin code.

    This could have been a good opportunity to get people to try out Kotlin if done right; now I'll just have bad memories of it instead.

  • »
    »
    17 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    +1 I was running a lot of inputs in custom invocation until I noticed the pattern and figured out the problem but it was quite slow.

  • »
    »
    17 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    For me this was even funnier. I've read this part in the statement "the solution is written in assembly" and thought that the solution is literally written in assembly. So I've spent several minutes rereading the statement and redownloading zip archive trying to figure out why in the downloaded files there is only some Java-looking code (since I've never seen Kotlin before) and no ASM-looking code.

  • »
    »
    17 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится +8 Проголосовать: не нравится

    On ubuntu that's just snap install kotlin btw. And for windows/mac any LLM should give you a short instruction to get CLI version.

    I agree that installing it during the contest sucks. But tbh there is no real rule that you should use python/cpp, and using them just because everyone uses them will solidify them without any particular reason.

    My complain about having VM in Kotlin is that it's just an extra layer of abstraction without any particular add-on to the problem. I am not sure it's really possible to distribute an ASM code to everyone so everyone can run it, but my problem is that I need to study this specific machine to verify if my ASM intuition works or not. (and, well, i spent a while decomposing some parts of it).

    Also the single code file is not documented while for any ASM you can find information online. And LLM's are probably better with converting any ASM dialects than with custom emulator. There should be a better sweet spot, but I haven't done my research on that, maybe I'm wrong.

  • »
    »
    17 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    That is unfortunate and we apologize for the inconvenience. We will definitely provide better instructions next time.

    We hope you’ll give Kotlin another chance though :)

  • »
    »
    17 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Yeah, we are really sorry for this. We had an idea to ask you to do this, or suggest using play.kotlinlang.org, but last several days before the contest too many things were happening and it slipped from our minds :(.

»
17 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится +9 Проголосовать: не нравится

pick team testuwuers (reirugan Friedrich Intellegent) as a wildcard! as a team of three (self-identified) anime girls, we will bring a very necessary demographic to the competition

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

hope there is a mirror for the finals!

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится +66 Проголосовать: не нравится

No programming language restrictions, but need to setup a Kotlin environment and run/debug/understand a Kotlin program :(

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится +20 Проголосовать: не нравится

That was really cool! Didn't know optimization contests could be fun for me too!

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится +20 Проголосовать: не нравится

Thank you, I got some really good IPSC vibes from the contest.

It was also interesting to observe that we got quite an amount of points by producing a very small amount of code (C1), or none at all (B1, B2).

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится +30 Проголосовать: не нравится

It is understandable that, given the vast number of qualified contestants (75), it is not a small expense, and we should not take it for granted that all the expenses will be covered.

But on the other hand, it is also disappointing that the main expense for contestants, flight tickets, are not covered (except top 3 teams and students), given the number of sponsors and previously mentioned that "aim to cover trip expenses for the finalists" in the rules and updates.

»
17 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится +21 Проголосовать: не нравится

The restrictions on travel expenses are one issue, but it's still a bit difficult to understand why only two nights are covered when the event runs from the morning of one day to the afternoon of the next. Considering that participants might have to stay up all night, it seems a little tough for them, doesn't it? I do understand that accommodating 25 teams is quite a challenge.

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

On one hand, I actually feel relieved knowing that our team's flight tickets won't be covered after finding out that I would probably have to go to another country to apply for Serbian visa.

On the other hand, it feels a bit disappointed with how we've been communicated. I guess the organizers probably wanted to wait until the qualification concluded to estimate the cost they would need to cover (hence, the part "as many of the trip expenses for the finalists as possible"). Something like "we won't guarantee to cover all expenses for finalists" from the beginning would be more transparent.

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

For the folks who solved problem D in the finals, how did you approach it? We found the problem very interesting and weren’t able to make any use of LLMs to solve it (other than the first input).