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

Автор pinely, 3 года назад, перевод, По-русски

Hello, codeforces!

Pinely is a high-frequency trading company. We trade at the exchanges all over the world. This year we are the sponsors of the online PTZ competitive programming camp. We have prepared a fun contest for camp participants and invite everybody to join it on CodeForces!

Pinely Treasure Hunt Contest will be held on Saturday, 05.02.2022 13:00 (Московское время).

The participants will be offered to solve an interactive optimization problem with open tests and will have 3.5 hours to work on it. You can join individually or in teams of up to 3 people. The contest will be unrated. Winners among camp participants as well as the 3 best teams in overall standings will be awarded with pinely t-shirts.

Since the contest is targeted for participants of the PTZ training camp, it'll be most interesting for participants with codeforces rating 2000+.

We are grateful to MikeMirzayanov for the opportunity to host the contest on codeforces.

A couple of words about pinely: we conduct algorithmic trading on various exchanges. Our offices are located in Amsterdam, Singapore and Cyprus. Our colleagues face various challenges, such as: coming up with trading strategies and implementing them, optimizing trading systems to achieve the fastest reaction to the market events, storage and processing of high volumes of historical data. Ability to write effective C++ code, algorithmic thinking and mathematical intuition are all useful in our day-to-day work, so a significant part of our team participates in various programming and math competitions.

To learn more about pinely you can visit pinely.com or you can find our colleagues on CF in pinely organization. You can send us your CV to [email protected], even if you are not participating in the contest.

Good luck and have fun!

UPD Congratulations to the winners!

Winners of the joint contest:

  1. itmo.algo.teaching: tourist, pashka, budalnik

  2. SPb NRU ITMO 3: VArtem, antonkov, qwerty787788

  3. xyr and his friends: wygzgyw, frame233, wasa855

Winners among the participant of PTZ training camp:

  1. Never Give Up: Valera_Grinenko, ivanz, 353cerega

  2. Saratov SU Daegons: awoo, Neon, vovuh

  3. A-SOUL_Unofficial: Pub, pigstd, dXqwq

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

»
3 года назад, # |
  Проголосовать: нравится -54 Проголосовать: не нравится

rated?

»
3 года назад, # |
Rev. 2   Проголосовать: нравится -66 Проголосовать: не нравится

.

»
3 года назад, # |
Rev. 2   Проголосовать: нравится -78 Проголосовать: не нравится

it is rated ?

»
3 года назад, # |
  Проголосовать: нравится +20 Проголосовать: не нравится

On the same day as the Quora contest just before it, we will have an interesting day

»
3 года назад, # |
  Проголосовать: нравится +22 Проголосовать: не нравится

А что подразумевается под "интерактивная оптимизационная задача с открытыми тестами"?

Нужно будет решать тесты локально, а отправлять только ответы? Или посылать код, который решает задачу на сервере?

Предполагается, что в итоге команда отправляет одно решение, которое написано на одном языке программирования, или будет можно, например, написать разные решения для разных тестов?

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +44 Проголосовать: не нравится

    Отправлять нужно будет решение, которое будет коммуницировать с интерактором на структуре, которая известна для каждого теста. Формально разные тесты будут выделены в отдельные задачи, поэтому можно будет отправлять разные решения для разных тестов.

»
3 года назад, # |
  Проголосовать: нравится +18 Проголосовать: не нравится

This contest is a great rehearsal for Hash Code!

Also thanks for avoiding a time conflict with Quora's contest.

»
3 года назад, # |
  Проголосовать: нравится -26 Проголосовать: не нравится

Is this contest rated?

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to register for this contest as a team , like the leader must individually register and then we can enter , or what's the process ?

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

    After you click on register contest, you have 2 options.

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

      But it shows nothing when I click box of choose team (after selecting as a team member option). How to proceed?

      • »
        »
        »
        »
        3 года назад, # ^ |
          Проголосовать: нравится +14 Проголосовать: не нравится
        1. Go to you profile page and select "TEAM" tab.
        2. Here you can see a "Create new team", click it, enter team name, and a new team will be built.
        3. You will see "invite user" at the main page of the team. Click it and invite your teammates.
        4. Wait for you teammates to accept.
        5. Go to contest page, there you can select your team to participate. That's it!
»
3 года назад, # |
  Проголосовать: нравится +16 Проголосовать: не нравится

Is this problem about algorithm, or about puzzle, scenario simulation or machine learning?

»
3 года назад, # |
Rev. 3   Проголосовать: нравится -33 Проголосовать: не нравится

Pinely

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

    is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ? is it rated ?

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    Why you guys are always after rating ? There is also a world beyond that.

»
3 года назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

Is it rated?

Third paragraph 2nd line:- The contest will be unrated.

Thank you!

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

    just FYI they edited the post after some hours and added that the contest is unrated, so most of this comments are not trying to be funny but the answer was just not there

»
3 года назад, # |
  Проголосовать: нравится -32 Проголосовать: не нравится

Why the contest is not rated? :( Rated contest gives more feel

»
3 года назад, # |
Rev. 2   Проголосовать: нравится -15 Проголосовать: не нравится

。。。

»
3 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

i think difficulty of the problem will be 3500.

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Will AI register? [doge]

»
3 года назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

Will terminators participate in this contest

»
3 года назад, # |
  Проголосовать: нравится +94 Проголосовать: не нравится

Please share your thoughts about the contest :)

Some ideas of our approaches to different tests:

1) Leaves are easy to traverse: just go there and return immediately

2) If there is an unvisited adjacent vertex, we can go there. Which one to choose? Firstly leaves, than for example with smallest/largest degree or, if the graph has a specific repeatable structure — based on a custom function from set of degrees to degree that should be chosen

3) If all the adjacent vertices has been visited, where should we go? Maybe at random

4) Or we can try to simulate depth first search, let's try to go to parent: choose some vertex having the degree of the parent. If we are unlucky — let's try to get to parent twice then. This works if there are not many close vertices with the same neighbourhood descriptions.

5) Alternatively, we can agree to end up in some indirect ancestor of the path. Let's find a matching description then and pop the suffix of the path. In both approaches 4) and 5) if something goes wrong we can stick to 2) — probably there'll be few vertices left to traverse.

6) Another alternative is to write beam search: we can maintain some bounded number of states (vertex, bitset of visited vertices), possibly with their probabilities. Then use some heuristics to pick the best next vertex degree for each state and then choose the degree from a discrete distribution. The option could be "go along the shortest path to some unvisited vertex" or something different that makes sense.

7) One can also add a simple path to the state and the vertex will "vote" to go to its parent, thus simulating a "beam depth first search". There will be more states, but probably not many on some graphs.

8) If you are traversing a tree maintaining states, there's no need to add states for all isomorphic subtrees if there are many such options. Let's assume we're traversing them one by one.

9) Try to research the graph structure: it it has some regularity, probably you can traverse it optimally, using hardcoded functions from set of degrees of neighbors to the desired degree. This can give improvement which even reaches the optimal TSP solution.

10) If you have time, you can try to automate the approach from 9).

11) One can divide the graph into 2-connected components, traverse them and articulation points optimally and use some greedy approach inside the components.

12) If you run out of ideas how to significantly improve your algorithm on interesting tests, then you can take your time to abuse randomness: for example, bruteforcing your seed.

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

    Simple randomize can get 2100 points...

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится +1 Проголосовать: не нравится

      Can you please share code of your solution? I would be very happy to check how you implemented it.

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

        Here's my code: https://paste.ubuntu.com/p/5yJHHfQTrG/

        I only use the information of degrees and flags. For each step, try to visit unflaged vertexes firstly, then flaged vertex. I tried some strategies like sorting by degrees (increase/decrease) or picking them randomly (for prob C, just go to the biggest degree vertex). Theres' another special case: if degree = 1 and flag = 1, never visit this vertex again. Then just submit these codes and see how lucky I am (・∀・)

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

    For future rounds: it would be more convenient if you names the problems by tests. I tried to hover my cursor over the problem index in the scoreboard to find out where I lose so much, just to see "treasure hunt"

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится +13 Проголосовать: не нравится

      We agree, it was a brand new format for codeforces, probably for next such round (if any) this feature could be implemented. You've also noticed that the archive with tests was attached 11 times :) The alternative was to copy the problem 10 times in polygon, which doesn't look like a safe and convenient solution.

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

    An example of approach 9) is the test J3. There you have a clique of size 40 sharing 6 different vertices with 6 cliques of size 11 and also a vertex with a path of length 200. To optimally traverse this graph you need firstly to traverse all small cliques, then traverse remaining vertices of the large clique (or vice versa) and only then go along the path. If you enter the path earlier, you might get stuck there for quite a long time. Since the vertices are very easily distinguishable based on their degree, it's quite simple to traverse that graph deterministically.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +86 Проголосовать: не нравится

    Thanks a lot for the contest! It was fun, even though pretty random (but maybe "random" actually contributed to "fun").

    Our initial approach was going to the unvisited neighbor with the smallest degree or, if all neighbors are visited, choose one at random with weights proportional to their degrees. This approach actually lived till the very end, resulting in the best scores for some test cases.

    Another useful approach implemented by budalnik was similar to beam search you described in 6), I believe.

    We also solved H1-H3, J1-J3, and K3 perfectly, and I wonder what other test cases were solvable perfectly. It was interesting to figure out the structures of the graphs and the algorithms to traverse them. On the other hand, test cases like D1 seem kind of unsolvable — after you end up at the end of the chain, it seems the only way to go back is to keep trying (?), and the only meaningful way to increase your score is to make more submissions with different random seeds.

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится +55 Проголосовать: не нравится

      Thanks for the kind feedback! It seems that your G1, G2 are also optimal: these are trees on which dfs from 4) should work perfectly and so do some other approaches. We don't know if other tests are solvable perfectly if perfectly means "deterministically use number of moves equal to tsp problem output". It's great that your team got all the perfect scores which were intended, congratulations on that and the victory! :)

      Indeed it seems there was too much randomness, probably having more tests like H and J would make the contest more fun.

      Your initial approach makes sense, somehow we haven't tested a version with discrete distribution proportional to degrees of the vertices (though we've applied such distribution in "beam search-like" solutions, which helped to avoid infinite loops). Kudos on making the simple (on a first sight) approach to successfully solve many tests :)

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Will there be editorial?

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +15 Проголосовать: не нравится

    Since the problem is marathon-style, we don't see how the classical editorial would look like. Instead we've posted several ideas how to approach the problem in the comment. One can implement some approaches and run them on the tests. If you have specific questions to this description — feel free to ask in the thread.

»
3 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

rank 97 for lucky.

»
3 года назад, # |
  Проголосовать: нравится +11 Проголосовать: не нравится

My main approach was something like "go to a random unvisited vertex with the smallest degree among such ones, if we cannot, then go to a random vertex with degree > 1".

How to solve Kneser-2? I can achieve 89.2309 on Kneser-1 and 84.8935 on Kneser-3, but I have no idea how to distinguish vertices in Kneser-2

»
3 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

I just applied various combinations of randomization of vertices which can be visited and which cant be visited and submitted. It got me 1600 score. I didn't use a single fact which is related to graph to optimize. lmao

»
3 года назад, # |
  Проголосовать: нравится +60 Проголосовать: не нравится

Would be nice if contests like this would provide an interactor for the problem, like how IOI or GCJ does.

»
3 года назад, # |
  Проголосовать: нравится +11 Проголосовать: не нравится

Contest of LUCK! That's such a funny contest, especially when we submitted one code for many many times just for tiny changes of scores.

»
3 года назад, # |
  Проголосовать: нравится +13 Проголосовать: не нравится

Would post-contest submissions be allowed after a while?

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

There should have been a cap on number of submissions. My team got to 1900+ points just by selecting a random unvisited (or visited if there are no unvisited adj nodes) node out of the available ones, and then spamming submissions lol

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

    Yes, we underestimated the power of random abuse in the problem, sorry for that. We thought that most participants would try to study the structure of specific tests and make tailor-made solutions for them, but it turned out seed brute force often was more advantageous.

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Автокомментарий: текст был обновлен пользователем pinely (предыдущая версия, новая версия, сравнить).

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by pinely (previous revision, new revision, compare).

»
3 года назад, # |
  Проголосовать: нравится -27 Проголосовать: не нравится

Unrated, right?

»
3 года назад, # |
  Проголосовать: нравится -26 Проголосовать: не нравится

Very bad contest for me