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

Автор ma5termind, 9 лет назад, По-английски

Hello Codeforces community!

I am glad to announce that HackerRank 101 Hack 29th edition will be held on 23rd September 2015 at 16:30 UTC. You can sign up for the contest here. Though what's priceless is solving interesting problems and the thrill of competition, prizes make the competition fierce. Top 10 performers will get a HackerRank T-shirt.

Problems have been set by ma5termind and tested by wanbo. The contest will consist of 5 problems with variable scoring distribution. We have tried our best to prepare a nice problem set. Xaero is the main character of the problem set. He is one of the awesome person I met in my whole life. So, your main task would be to help him in each problem. Although, Xaero is smart enough to solve all of these problems but he is quite busy these days.

Hopefully everyone will enjoy. Also, you'll be able to enjoy the detailed editorials written by the setter.

Good luck and have fun!

UPDATE

Editorials for all problems are up.

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

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

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

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

Please provide me feedback on the problem set so that i can prepare a even better contest next time.

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

    Problems like "copy-paste treap" are boring :(

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

      But problems like "copy-paste palindromic tree" are not, aha.

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

        I have nothing to do with such problems :)

        Anyway if you prefer to copy-paste Manacher's algorithm + suffix tree, it's up to you ;)

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

    Problems 2, 3 and 5 were about equally easy IMO (which is: pretty easy, one was tree DP, one bitmasking prefix-sums-thingy and the last one sweeplining and classic DP, which is all basic algorithmist's equipment). Except 2 was just a slight variation on a standard problem and 3 totally a standard problem; the last problem wasn't, but it's far below what I'd expect (I solved it in 20 minutes).

    On the other hand, problem 4 was above what I'd expect from problem 4. My solution to the "reversals in permutation" subproblem (the hard part) was sqrt-based, we store info about the current permutation as , where P0 is explicitly known and P1 is a sequence of arithmetic segments with difference  + 1 or  - 1; when there are more than segments, recover P1 and merge it with P0 (and set P1 to identity); otherwise, a reversal in P1 can be performed in time. I wonder if there's a simpler solution...

    The sqrt-decomposition didn't come immediately to me, but even then, it does require a bit of careful work with reversals in P1... definitely harder than the last one.

    I struggled a lot with the language. There should be better, or existing, language review.

    Overall, one of the easier contests even for HR. At least I finally solved everything :D

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

      Thank you Xellos for you feedback. I will keep this in my mind while preparing problems for a contest in future again.

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

    The memory limit in the third problem should have been larger. I had troubles with creating an array of 226 elements (I received Abort Called on Hackerrank) and had to use std::map to maintain the masks. This solution had TL only at last testcase, so I had to add a tricky optimization with char array, maintaining the last testcase when the mask existed modulo 256.

    UPD OK, I accidentally used long long instead of int here :) But usually ML is double of the memory used by the author's solution, I have some doubts about it in this problem :)

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

Solution of Xaero And The Enigma Hacking without treap: #oQF6U0

Btw, has anybody write it from scratch?

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

UPD: My fail. I've misread problem statement, such problem was in NEERC 2012.

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

    IGNORE

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

    It's also an identical version of a standard problem :D

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

      Great Xellos !!!! I agree to each and every point that you have stated above. I also feel sorry that i was not able to deliver you an interesting set of problem but now you are saying that 4th problem is also an "identical version of a standard problem" which i guess you enjoyed the most in the whole contest. Please do not call everything standard if you know a lot of things or solved a lot of problems. I tried my best to come up with the ideas.

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

Does anyone else have problems solving last 4 tests of "Xaero And The Enigma Hacking" with java?

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

Screencast, if anyone cares

UPD: with discrete optimizations again!

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

Can someone explain his solution for D in a bit more detail (with or without treap, doesn't matter).

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

    Let's replace every '?' with its number. Then after processing m queries (with or without treap :) we will know how string will look at the end. So we can merge equivalent positions in connected components and check if there are any contradictions. If there is no contradiction there will be some "free" '?'. Let's find representation of k base 26 and replase such free '?' with letters from this representation.

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

    Please look at the editorial section for the solution and its explanation. I tried my best to explain everything.

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

isn't this contest rated ? the ratings didn't update till now!

the problems were hard for me. However, the editorial is really well written thanks for your efforts!