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

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

Всем доброго времени суток.

Скоро состоится Codeforces Round #315, авторами которого являются студенты УрФУ sivukhin и Um_nik. Это второй наш раунд, первый пришелся на черные дни Codeforces, и мы надеемся, что второй наш раунд не вызовет таких катаклизмов :)

Мы хотим поблагодарить команду Codeforces за эту замечательную платформу и Polygon. Особенно хотим отметить Zlobober за помощь в подготовке задач.

Желаем всем удачи!

UPD1:
Разбалловка.
div2 : 500-1000-1500-2250-2750
div1 : 500-1000-1500-2250-2500
Настоятельно рекомендуем прочитать условия всех задач. Мы постарались подготовить достаточно разнообразные задачи, вполне возможно, что сложные для нас задачи будут простыми для вас.

UPD2:
Разбор

UPD3:
Поздравляем победителей!

div1:
1. KAN
2. Petr
3. enot110
4. tonyjjw
5. Konijntje

div2:
1. Lost
2. loser21
3. fyiwxp221
4. hqpwca
5. LazyWolfLin

Всем спасибо за участие.

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

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

Желаю всем адекватных результатов.

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

One suggestion to Codeforces team, Please do not allow someone to name their handle which has slang or obscene word or may be their handles are part of it. Thanks.

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

where's your previous round? "I don't know what black days are."

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

скажыте пожалуста раунд будет рейтинговый иле нет?

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

Good luck to everyone!Wish you high rating! And thanks sivukhin and Um_nik for this round! It's good to have another chance to practice more!

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

Here's a suggestion: Please hold more contests at 17:00 ~ 19:00 Moscow time. That time is more available for Taiwanese and Chinese coders. There are many of them!

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

    Jeffrey I dont think that you should say anything trying to separate China. Plz mind your words.

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

    I agree with Ir1d. Taiwan is an inalienable part of the territory of China, always. Please be careful what you say.

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

    Jeffrey Taiwan is an inalienable part of the Chinese territory.

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

    There will be 2 sites. What wrong with site like codeforces?

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

    Taiwan is a part of China... Of course ,don't talk too much about politics

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

      Speaking from a country clouded by all sorts of censorship, your comment is so trustworthy!

      Okay I'm kidding, I kind of feel sorry for you,
      since you've been brainwashed by a corrupted government since your birth :)

      Of course, I still respect your freedom of neglecting the fact that Taiwan is an independent country and spitting out ignorant comments :)

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

        I do not think you really don't expect politics to be brought up on Codeforces as you said before. How dare you say Taiwan isn't corrupted? I'm so sorry but what you said is a joke. I won't argue about it anymore because history will give us the satisfied answer like HK and Macao.

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

        I have to say something again.Even though we all know Codeforces is not a site for politics.

        lnishan

        We don't need you to feel sorry for anyone.

        Just feel sorry for yourself.

        As I was saying,please mind your words. Codeforces is not a place for you to fill with nonsense delusion.

        So should I guess that you have your own mind and you are not yet another machine used by a stupid government to spread fake things?

        Time is the judger for what's right and what's wrong.We have our own beliefs and don't you dare say anything about it as we respected you as a man.

        It's really a waste of time to write so much.D

        Taiwan is part of China.

        It has been before.

        And it will be in the future.

        AS ALWAYS

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

          You're the one being delusional.

          Feel like googling "Taiwan" and look it up on wikipedia?

          Oh wait, you can't :) (without using VPN, proxy)

          This is just pathetic.

          Oh and, this will be the last comment I made on this topic.

          Not interested in arguing with some politics zealots.

          Keep living in your own world where every country is yours essentially.

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

            hahahah, young man, so jump.

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

              i mean Inishan is so jump. his words are so impolite, but some people still vote up for him. i dont know why,it is just sarcasm, taunt and discrimination. then pretend to be aloof from politics after saying the words, and use":)" to show his "accomplishment". In a word, Inishan's words are so arrogant, and do his grandparents and ancestor know?

              I never talk about politics in public places, even this time. but plz mind ur words and be polite to every one. I dont mind my contribution, if u insist on supporting him, a ungratefulness and mean person.

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

    I don't know much about Taiwan and China, I just want to say that starting time is a sensitive issue for us all.

    In Korea, we take 'regular(19:30 MSK)' Codeforces round at 01:30(Of course North Korea would have it 01:00 :p). When the round was at 17:00 MSK, we took it at 23:00, which was really great(you can see me excited here). Even a tiny shift was very convenient for me. However, at the 17:00 MSK contest, many people were embarrassed, as their schedule(job, school, etc.) hadn't ended. Many other shiftings were preferable for some people, and uncomfortable for others. I am lucky too, because it doesn't really overlap with my schedule — it's just too late, and I will probably fall asleep in morning class. Some people might have regular rounds in the middle of their day — for example, New York has it at 12:30.

    We are competitors from all over the world, yet users of Codeforces. Administrators of Codeforces don't realy have to make equality on opportunity. I personally would really like an early contest, but if it's not preferable, we can't request... I just 'hope'.

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

    Taiwan is just a part of China. Why so serious?

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

    The point is that earlier contest time is more friendly to coders in East Asia. I wanted to vote 'up' but misclicked it. Sorry bro. :)

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

    I agree with JeffreyHo. I'm from Vietnam and it is difficult for me to participate in a contest. It is usually held from 23:30pm to 1:30am. So, can you hold the contest earlier?

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

    I agree with JeffreyHo. I'm from Vietnam and it is very difficult for me to participate in a contest. It is usually held from 23:30pm to 1:30am. So, can you hold it earlier?

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

Это число и Цукермана и Хардаш`а, но почему это просто раунд 315?

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

    Может быть, не нужно каждый раунд называть чьим-то именем?

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

Почему количество комментариев, которое указано под темой не соответствует их фактическому количеству? (до моего комментария система говорила, что их 32, фактически было 16)

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

Чувствую ненадолго я в синие вернулся ;)

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

Сравниваешь английскую и русскую версию и понимаешь, как богат руский язык ;)

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

Я оставил комментарий, который за 4 часа собрал -180. Я мог оказаться на 8 месте в списке Бредора http://codeforces.com/blog/entry/15998. Но опущенские модераторы его удалили! Позор им!

Раунд #315 провален, можете расходиться :(

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

I missed those black days of codeforces,but happy to witness black days of topcoder :)
Hope they will overcome too.

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

    when did that happened ??

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

      if you are asking about codeforces black days you can find it here, but if you are asking about topcoder I would say almost every SRMs of topcoder had some issues these days. So, I told it as black days for topcoder.

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

        You are right.

        It seems that the little issues that pops out almost every TC round is as critical as the black day's of CF, "which I'v witnessed on my third Round by the way".

        However I started to get a more fan of TC than CF, hope they work out these issues :D

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

World Consumer Rights Day Round!

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

Your problems in the previous round were very interesting I hope this round will be the same :)

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

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

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

This round shuld be called #NotPI :)

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

This time they told Score distribution SOON ;) THANK YOU |: ################################################################################

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

Это ваш первый раунд?

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

    Глупый вопрос.
    Это второй наш раунд, первый пришелся на черные дни Codeforces, и мы надеемся, что второй наш раунд не вызовет таких катаклизмов...

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

    ...
    Это второй наш раунд, первый пришелся на черные дни Codeforces, и мы надеемся, что второй наш раунд не вызовет таких катаклизмов :)

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

You know, Div 2 contestants should not compete in Div 2-only rounds....the irony!

Edit:I know this is a div1+div2 round, just saying...

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

"U contest" sounds good to me. Because Organised by "U"mqra and "U"m_nik of "U"ral "U"niversity .

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

Эм, а почему стоимость задач div1 не соответствует стоимости задач div2, как это обычно бывает?

То есть, если div2: 500-1000-1500-2250-2750, то div1: 500-1250-1750-...

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

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

    Поэтому: почему бы и нет :)

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

Problem E costs 2750, it going to be interesting!

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

hope to not see Succesful Hacks on Div 1.A :D

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

I was away from CF for few weeks and what's this? They are no longer declaring the score distribution at last moment! When did people started playing safe?

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

WTH with A?

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

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

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

      Very disturbing one!

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

      Xellos I usually like your memes very much but this picture is very distasteful please can you remove it ?

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

        I don't find it distasteful, I don't care about getting downvotes and since it's getting plenty, it's going to be invisible by default soon, so I don't even need to do anything.

        And I can't delete the comment at this point anyway.

        But if you can't bear it existing even hidden, there's always the option of walking away from the screen.

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

          Actually, its so "distasteful" that its actually funny :p

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

          "I can't delete the comment at this point anyway"

          Couldn't you edit your comment? Learn from him how to hide your comment.

          And, "I don't care about downvotes" — means you don't care this community! Mind your words...

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

            Couldn't you edit your comment?

            "it's going to be invisible by default soon, so I don't even need to do anything" — logic is there if you don't take things out of context

            "I don't care about downvotes" — means you don't care this community!

            No.

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

    ?

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

Codeforces is hanging. Can't read codes of roommates.

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

When B has more solves than A...

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

Is the answer for DIV1B this sequence?

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

    Yes sir, first difference of the bell numbers.

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

    yes,it was also 2nd number sequance of bell -_-

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

    This is why I hate a single-input problem. People that has no idea at all can just do bruteforce, find the several first number of the sequence, google the sequence and get the answer.

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

      There were two sequences corresponding to 1..5 answers. It was difficult to choose between them :)

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

      Why do you think this is an approach that should not be available? It looks quite creative and risky to me.

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

      It can be even worse than that! The sequence in question is number 4 increasing sequence from the search based just on the 3 given problem examples: https://oeis.org/search?q=1%2C+3%2C+10

      And the other (wrong) sequences could be rejected by simply copy pasting and running them against pretests. Shame on me, but that's what I did after I failed to "invent" this sequence on my own. Still, bruteforcing via pretests cost me quite a few points.

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

Why 10^9 in div1A is AC? I am about the solution without Sieve of Eratosthenes.

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

    It's kinda not 1e9, because not all the prime numbers are 1,2*1e6 and if it's like divisible by 2, that is finished in 2 iterations(assuming isprime breaks at right time).

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

    Actually, it's not 10^9 because of rare up to square root computations.

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

a bit hard contest , Just a Bit

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

Funnily enough, I solved A but not B. Can someone help me find the bug in my code (I keep getting a runtime error on test 7)? http://pastebin.com/tYXaAaEx

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

Guys, why SolveB was easier then A? More people solve B!

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

    For me, the description of the problem A was very confusing.

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

    I think that many people didn't think enough on A.

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

    The authors forgot to mention in problem A that the song continues to download as it's playing. Their mistake is understandable -- what they meant is reflective of real life -- but I can definitely see how it confused people.

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

    A becomes more easier when you realize a statement, and much more easier when you realize a solution.

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

Какой threshold в A?

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

    1179858

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

      А там хоть когда-то надо про дерево палиндромов выводить?)

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

        нет

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

        Нет )

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

        Очевидно, что число 1 всегда подходит, так как pal[1] = 1, а prime[1] = 0.

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

          А почему найдется наибольшее такое число?

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

            Не для всех чисел оно, кстати, найдется :) . Количество чисел-палиндромов с константой, примерно равной единице(потому что для первых (len + 1) / 2 знаков числа всегда существует палиндром, при том единственный), в то время как количество простых чисел — субполиномиальная величина, но растет быстрее на начальном этапе

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

How to solve B(div1)?

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

    Let's say that equivalent numbers have same color. And all numbers such that they are not equivalent to themself have color 0. Let Fi be the number of ways you can color n points in exactly i colors. Then it is easy to see that . Now the answer is because order of colors except 0 doesn't matter here.

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

Problem A has the worst statement i have ever seen in my life, i don't want to ofend you guys, but it was really bad, poorly explained, i don't like to do try/error on contests, even the clarification did not help much either.

Overall felt the contest was rushed and not tested enough (statements where not good) that is my opinion , of course people that guess the tasks only by input and output are going to give me negatives, but i don't care, had to speak up.

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

    I agree with you lol

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

    I agree with you about Div2 A, but the rest of the contest seemed ok to me, just a bit harder than usual.

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

    Definitely agree. The examples didn't make much sense, and the clarification was pretty much exactly the explanation for the example(which was also confusing). Maybe a picture would have helped.

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

    You are right, problem B was solved by more people than A! I wonder, how hard it was! (I don't know how hard because I am still unable to understand the problem.)

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

Does anyone have something better than randomization for div1 D?

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

What is solution to Div1C? Is 2-sat involved?

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

    Exactly. You can use 2-SAT to check if there is any correct word with given prefix.

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

Div1C Крайне плохая задача для двух-часового контеста.

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

That moment,when there are two cheaters in your room and u hack both of them :)

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

problem statement for problem A.(MUSIC) was very poor had to find meaning from test cases

»
9 лет назад, # |
  Проголосовать: нравится +16 Проголосовать: не нравится
  • Why were the TLs in C-Div1 so strict? I lost much time optimizing my 2-SAT in order to pass the pretests.
  • Also, D is very similar to this task on Polish SPOJ: http://pl.spoj.com/problems/AL_09_04/. Translation: There are n points on the plane. Can you cover them using k lines? By the way, has anyone tried solving the problem using meet-in-the-middle technique?
  • »
    »
    9 лет назад, # ^ |
      Проголосовать: нравится +12 Проголосовать: не нравится

    tfw you optimise againt TLE and get RE instead

    also tfw I know I'm going to get WA

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

    There is no need to iterate through all characters from 'a' to 'z' while finding next symbol. One can observe that we can change any vowel to other vowel, and any consonant to other consonant, and the status of the transfromed string will be the same, e.g. whether it's in language ot not. So, finding next symbol requires exactly two 2-SAT checkings and therefore, you can solve this problem in O(NM),

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

      I had this optimization from the very beginning.

      What I did later was: (a) change the adjacency list in 2-SAT into adjacency matrix, (b) return -1 if M > 3N(N - 1). It worked something like two times faster and it passed pretests. (Of course consonant-only alphabets killed me...)

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

      I wasn't iterating through all characters and still barely managed to fit within TL, spending 35 minutes and 10 attempts to make it :)

      Rough bound which I got: 200*200*4=160000 rules; 160000*2=320000 edges in my graph. 320000 on DFS + 320000 on RDFS=640000 operations on getting strongly connected components.

      200*2=400 calls of 2SAT while looking for LCP of answer and word from input; 200*2=400 more calls of 2SAT while restoring answer.

      640k*800=5.12*10^8.

      Quite a lot, now I am not surprised with TL16 :)

      I am pretty sure that it can be implemented much better (and I'll look at other implementations to learn how to make it faster, thanks to authors), but looking at list of attempts with TL16 during contest — I am not the only one who struggled with it :)

      At some moment, looking at guys with time <0.1 on pretests, I thought "OK, I screwed up with wasting a lot of time on implementing obvious solution while I had to come up with something smart".:)

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

        mnbvmar, I_love_Tanya_Romanova, I see you. Indeed, I didn't think straightforward approach could lead to TLE. Sometimes it's better to spend more time to think and use not the very 2-SAT algorithm, but only ideas from it)

        We can find transitive closure of 2-SAT graph in O(NM) before processing string, and the only information we use from it is reachability from a to !a and vice versa.

        Now, when we have some prefix, we can fix vertices that must be visited in any case (respective to positions in prefix), and after that, while processing two vertices correspoding to other positions in string, we can use information about reachability to decide whether vertex to use.

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

Looks like about half of the solutions for div2 A are failing...wow...

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

    Is this the first time the A problem has had less than half the solves of the B problem?

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

O(n^2) space complexity solutions are getting accepted for Div. 1 B ? Like seriously ?

EDIT : so wow , much butthurt. I should write these kind of opinions on the complexity of solutions more often just to see the "butthurt impact" it has on people.

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

    Why not? n = 4000, n^2 = 16e6?

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

    "I can't calculate or try custom test, but it's totally not my fault."

    your post in a nutshell

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

      Do me/you a favor and multiply that number by 2 and "calculate" the difference between 256 and that number. Then use the acquired info to understand that two arrays of that size + bunch of other stuff won't fit in 256mbs of space.

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

Thanks for the awesome contest (especially D and E)!

To get D accepted, I need to add "if (k == 0) return;" to my solution. First I lost Yandex because of a bug in the prime number generation, then this :(

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

    What you did wrong in prime number generation?

    • »
      »
      »
      9 лет назад, # ^ |
        Проголосовать: нравится +24 Проголосовать: не нравится
      int n = (int) 1e6;
      int[] pr = new int[n + 1];
      Arrays.fill(pr, 0);
      for (int i = 2; i * i <= n; ++i) if (pr[i] == 0) {
          pr[i] = i;
          for (int j = i * i; j <= n; j += i) pr[j] = i;
      }
      
      • »
        »
        »
        »
        9 лет назад, # ^ |
          Проголосовать: нравится -7 Проголосовать: не нравится

        and where is bug ? It looks like the algorithm described on wikipedia https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes

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

        Ohh, I did the same mistake in Hacker Cup initial round, but first of all experience programmed like you did and specially in final which result in giving you 2nd spot. As I_love_Tanya_Romanova said, you are really unlucky in problem C for last couple of years.

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

        I was actually curious what problems people would see with this code. I see the following:

        1. Hardcoding n=1e6 is a bad idea. Had I not done that, I would've noticed the bug on the sample input.
        2. Using two different types of special values (pr[i] == 0 and pr[i] == i) to denote the same thing is a bad idea. I should've just filled with pr[i] == i initially.
        3. Issue 2 has appeared because I've initially had the code written with boolean array "pr", then converted it to integer array since I needed any divisor in the solution below. Had I thought the solution through before starting coding, this wouldn't have happened.
        4. I forget to convert actual pr[i] == 0 special values above sqrt(n) into pr[i] == i — this is the "final bug", but I think it's important to notice the three above issues that have led to it appearing and going unnoticed.
        • »
          »
          »
          »
          »
          9 лет назад, # ^ |
          Rev. 3   Проголосовать: нравится +1 Проголосовать: не нравится

          Actually I was also quite surprise by the fact the you initialize the value of array with 0 as default value which is not needed indeed. Then these two things comes into my mind.

          1. You started with initializing all the array values with -1 then changed it to 0.

          2. You had the boolean array(which is least likely) and changed it to int array as you use IDE so it suggest where you need to change.

          And btw I think p[i] == i, and initially filling the array value as its index would have been a better idea, it would have reduced your chances of making mistakes but you know better than me and sometimes minor details decide the result.

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

          If you remove just this line — pr[i] = i; and replace it with if (pr[i] == 0) the resulting array will be filled with 0 for primes and lowest divisors for non-primes.

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

Can someone explain what did DIV 2 A want us to do? I spent around 60+ minutes, and found it very unclear/contradicting. Not complaining about problem statements, but can someone explain it? Not the editorial, but phrase it in a better way.

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

    You have to sum the infinite geometric series with the initial value being the current amount downloaded and the rate being (q — 1) / q repeatedly until the current downloaded is greater than or equal to the total length of the song.

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

      Thanks chaosagent :)

      It is a shame for me that I designed this algorithm but discarded it for the reason of precision errors may take place :/

      I should have tried :|

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

        I actually failed the system tests because of floating point precision... I just deleted a few zeroes and now it works and I am very very pissed off lol

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

Bad luck!... Get AC after change EPS from 1e-9 to 1e-6 :( ...

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

Waiting for Editorial. I want to see jury solution of Div1. D.

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

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

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

Hoped to stay in Div 1 this time, but because of a really stupid mistake in Div1A, will probably go back to Div 2. :(

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

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

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

I only submitted B, and got a rating rise :D

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

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

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

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

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

it was the worse A that have been prepared !!!!! i solved B in 7 min and C in 20 min But not A !

but other problems were fantastic!!! WOW ;)

thanks for reading!

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

Not my best performance, plus part of code editing is hidden under Chrome, but still — screencast

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

I had an unusual and impressive experience in this contest. My program for problem C outputs -1 after running about 1.9s. And I allocated a block of memory with the size of 1000000. In my computer, my program only used 1/3 of the memory I allocated. During the contest I tested my program and everything went well. However on the grader, it runs much more faster and used all the memory within only about 1.8s seconds so it got RE before it output -1.

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

Amount of accepted solutions to A which had "Palindromic tree is better than splay tree" in code is damn too high!

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

    It's almost like a magical formula that gets solutions AC'd :D

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

    We've added this phrase just for fun (:

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

      Yeah, surely I know, but my point was that having this in code in most cases tells that people don't have an idea what is going on in this task and still managed to produce a correct code :P.

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

        Why take chances, that's why! Suppose some guy solved it without adding that line, and then got pretests failed for some reason, panics and adds that line, just in case it was the reason for wrong answer. Submits again, gets pretests failed again, realizes that line doesn't matter, but still, leaves it there, just to be safe, or maybe cause he forgets to comment it in a hurry.

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

For 569C - Primes or Palindromes?, reading the problem statement, how can one determine — "Up to which number he should calculate the number of prime and number of palindrome number" ?

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

    Editorial of the contest gives the mathematical proof that n < 107 even for maximum A = 42. So you can run once in your computer for A = 42 precomputing primes upto 107 to get the exact limit .

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

I forgot to use long long and get Wrong answer in problem 568A. TAT

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

I can't understand 3rd sample test case in B div1 "B. Symmetric and Transitive"

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

    1)empty set 2){x, x} 3){y, y} 4){z, z} 5){x, x}, {y, y} 6){x, x}, {z, z} 7){y, y}, {z, z} 8){x, x}, {y, y}, {x, y}, {y, x} 9){x, x}, {z, z}, {x, z}, {z, x} 10){y, y}, {z, z}, {y, z}, {z, y}

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

i think "E" can be solved with "divide and conquer & dp". this problem look similar to "http://codeforces.com/problemset/problem/101/E" ( my code : http://codeforces.com/contest/101/submission/13598464 ). they are similar because of limited memory.

we can solve 568/E using very basic idea. maintain length of longest sequence from any index i to n. if there is gap at i , store for all m numbers. if not a gap, only for one number. but it will take O(m*k + n) memory = ~10^8. now, divide the array into bucket of size sqrt. we can store all the information for first bucket. when we are done with first bucket , process second and so on. Space compexity = O(sqrt*k + n) ~ 3*10^7. decide the bucket size accordingly. Time complexity : O(m*k*FenwicktreeLogn(n)) .

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

i think problem "E" can be solved by "divide and conquer & DP". there is a problem with much similar idea ( http://codeforces.com/problemset/problem/101/E ) with my solution ( http://codeforces.com/contest/101/submission/13598464 ) .

The basic idea for this problem is to maintain a DP for each index i which store the maximum of length of LCS from i to n. if array has gap at i, then store for every m numbers , otherwise store for only one number array[i]. TimeComplexity : (m*k) which looks fine. Space Complexity : O(m*k+n) ~ 10^8 > 128MB. to resolve this problem, we can divide the array into blocks of size SQRT. now, store all the DP states for 1st Block , then 2nd Block and so on. so Space Complexity : O(sqrt(n)*m) ~ 3*10^7 , which looks passable. decide the bucket size accordingly.

Edit : Space Complexity does not passes. looks slightly greater than expected.