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

Автор MikeMirzayanov, история, 8 лет назад, По-русски

Добро пожаловать на 2016-2017 CT S03E07: Codeforces Trainings Season 3 Episode 7 - HackerEarth Problems Compilation. Продолжительность тренировки — 5 часов. Тренировка открыта как для команд, так и для индивидуальных участников. После ее окончания вы можете дорешивать задачи тренировки или поучаствовать в ней виртуально, если не смогли принять участие одновременно со всеми. Пожалуйста, участвуйте в тренировке честно.

Огромное спасибо Errichto за подготовку тренировки. Я сам бы так не справился!

Перейдите в раздел Тренировки для регистрации и участия.

Ориентировочный старт: 26 октября 2016 г., 16:10 (Московское время).

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

Условия задач будут на английском языке, ведь мы же готовимся к ACM-ICPC!

Удачи!

UPD: Тренировка завершена. Особое спасибо HackerEarth за предоставленные задачи! А герой этого дня несомненно Errichto — подготовил тренировку и дополнил её новой задачей. Браво! И спасибо авторам задач, класс!

Разборы почти всех задач есть в комментарии http://codeforces.com/blog/entry/47985?#comment-322692

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

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

The registration starts 6 hours before the contest!! isn't that a short time to register?

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

 I've just seen them on top1, and then...

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

    And then they got disqualified for searching problems in the Internet and copying all solutions.

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

I want to thank HackerEarth for allowing us reusing the problems (also thanks to the setters!), and to thank Mike for carefully checking everything, so you could have a nice contest. You can enjoy amazing and detailed editorials mostly written by pkacprzak.

A — Yet Another Problem with Strings

C - Stickmen

D — Strange Queries

E — Bravebeart

F — GukiZ Height

H — Precise Shopping

You can see my codes for H (both should get AC but the latter one is faster):

slower AC
faster AC

-

I - Prime Moving

J — Valentina and the Gift Tree

K — The World of Trains

And congratulations to danilka.pro, HellKitsune and IlyaLos for winning the contest (after they were far behind in the first half of the contest). Nice job!

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

    Time limit for problem A is very generous. It alows solution with complexity to pass.

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

      It was intended. What wasn't intended is that O(N·Q) passed, what was the combined results of: not all solutions uploaded in Polygon, weak tests and the fact that I wanted to let to pass, even though we didn't let it pass in the original contest a year ago, what I didn't remember (and unfortunately I marked this solution as AC in Polygon a year ago). If I knew that some O(Q·N) passes, I would cut TL significantly.

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

      Could you please answer me a question?

      I've thought up an idea that when adding a char after one of S , form a line just like a tail,and when the total length of the tails meets , rebuild the A.C Auto and its fail tree.

      I'd like to know whether it's right or what yours is.

      Thx.

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

    Thank you! Somewhy we were mostly stuck on problems solved by significant amount of teams, wondering what are we missing, and came up with them only closer to the end of the contest.

    As about problem A, one of our state teams got AC with Aho-Corasick algorithm (offline!). We checked their solution and found that it's very unlikely to be true, so it seems that tests are not weak just about missed TLEs.

    Though maybe you can show us why it works, or maybe it can be modified to be online? We've found some other solutions with Aho-Corasick algo, but none of those were fine to us.

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

    I've got something puzzling about question A.

    I'd like to ask how it works to modify the fail tree of Aho-Corasick Auto when adding a new node after one of S.

    Or the solution doesn't depend on A.C Auto at all?

    But how to "know how many strings from S are prefixes of the string corresponding to this node"?(Please ignore the question above)

    And how to operate when it's necessary that "Next, if there is no node corresponding to Si with appended c, we create it and set up its counter"?

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

      I've the same question how to modify fail tree efficiently?? I tried one pass on all nodes with level one less than level of newly added character but got TLE.

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

    In A's solution: "contains(t) := returns YES if at least one string from S is a prefix of string t. Otherwise returns NO". I though it was substring instead of prefix?

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

    I was trying to understand what other teams did with problem A and I found a problem: you don't have tests with equal strings. I changed multiset to set and still got AC. If you have two equal strings (with equal hashes) and change one of them you somehow delete both of the hashes from the set and it should get WA. :(

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

Nice contest, and thanks for the fast editorial!

Also J was such a HLD bait in my opinion, hahah

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

How to solve G?

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

    I used inclusion exclusion.

    Say we have m numbers out of which we have to choose n numbers with repetition allowed, without any constraint, the number of ways is .

    Let x = P1P2... Pk, where Pi = piei, where ei is exponent of p in x.

    Since x divides lcm(a1, a2, ... an), each of Pi divide at least one of ai. Let us remove cases where some of Pi divide no ai.

    So lets choose a subset Q = {Q1, Q2, ...Qm} of P = {P1, P2, ... Pk}. Let num(Q, a, b) denote the number of integers lying in [a, b], not divisible by any of Qi. Note that num(Q) can be found in O(m * 2m) by inclusion exclusion again.

    The answer is

    Since we are considering subsets of subsets, the overall complexity is O(k3k + n2k)

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

доброго времени суток.не знаю куда обратится лично, пишу сюда. Имею пожелание — хотелось бы чтоб на сайте была возможность просматривать количество решённых задач...

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

Извините, а вчера в 18:21 в 12 корпусе вы сказали, что нужно зайти на сайт и решить 10 задач, а это здесь?

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

Can anyone give me a critical input for the I problem "Prime moving" i am not being able to detect the bug of my code

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

Can Anyone please DM me the code of Problem-D