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

Автор SteamTurbine, 11 лет назад, перевод, По-русски

Всем привет,

CodeForces 180 начнется 19.04.2013 19:30 (MSK). Я (SteamTurbine), и Ivan Li (AEtheReal) являемся авторами сегодняшнего раунда.

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

Спасибо Gerald за помощь в подготовке раунда и MikeMirzayanov за его великолепную систему, а также Delinur за перевод.

Мы надеемся, что полярные медведи вдруг не решат съесть вас. Удачи.

UPD: Разбалловка будет динамической. Задачи расположены в соответствии с предполагаемой сложностью.

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

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

Good to see new authors here. what is the score distribution? standard maybe?

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

Creative and original)

P.S(1): Blog 17 hours and it is not the main :( (Already on the main! :) )

P.S(2): Sorry for my poor English. :)

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

wish all luck :-)

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

Я даже догадываюсь, кто мог это нарисовать ._.

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

Paint master :)

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

new authors and new heroes.

thank you for the contest and wish everyone lucky.

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

Thanks for the nice bears, I really enjoyed the picture.

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

Very cute polar bears~ :D

Looking Forward to the Round tonight.

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

Рисунок шедевр =)

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

Nice picture!!

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

Thanks for the great contest theme :-) I expect great problems "stories" and statements. Polar Bears , here we come !

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

От лица снежных белых медведей благодарю всех за помощь.

On behalf of snow polar bears let me thank you all for your help.

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

Just noticed that the polar bears are mirror images of each other!

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

Everybody good luck!=w=

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

The picture is looking good with round because:

1-The picture is of night and the contest is also at night. 2-The bears meet each other and participants will meet the solution easily.

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

It will be good if there will be short statements :)))))

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

Looking forward to meeting a polar bear...

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

As far as I tried, I couldn't find the dynamic scoring rule in the FAQ. Is this the version to be used in this contest? http://codeforces.com/blog/entry/4172

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

Have you noticed the stars between the horns of the Moon? :)

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

Hope Short stories and statement of problems.

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

Thanks to the authors and CF, This is my first round.

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

I love this contest.

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

I admire good art !

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

In problem "C div(2)" what does parity(a) mean???

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

One ticket to Div — 2, please.

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

Strange that there is so much submissions on div 2 for Parity Game: the distribution of the number of submissions for Parity Game and Fish Weight are inverted for div 1. A lot of system test fail ?

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

Как решать С?

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

    Я решал так. l1-количество единиц в первой строке, l2 -во второй. Тогда если (l1%2+l1)>=l2 то YES.

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

    The answer is always YES.
    On last minute I've submitted the following construction.
    Sort s and use the following pattern for a and b:

    0 # 0 # ... # 0 # 1 # 2 # ... #   k-1 #   k
    # 0 # 0 ... 0 # 0 # 1 # 2 ... k-2 #   k-1 #

    where k = (n+2)/3.

    The diagram means values in arrays a and b where each # can be found from s[i] = a[i] + b[i].

    UPD Failed system tests :(
    The correct solution to use k = n/3.
    Previous version fails on n=1 s[1]=0.

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

    Будем исходить из того, что s отсортирован и в нем 3x элементов. Если это не так, то добавляется чуть гемора, но решение не меняется. Тогда пусть в первой трети a[i] = i, в третьей трети b[i] = 4x — i, а во второй трети мы будем брать не занятые в массиве а в третьей трети числа по возрастанию. Тогда можно заметить, что во второй и третьей третях а все числа различны, как и в первой и третьей третях b

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

    У меня была такая конструкция (после сортировки):

    x x x x x x x x x (0 1 2 3 4 5 6 7 8, например)

    становится

    x x x 0 0 0 x x x (0 1 2 0 0 0 4 6 8)

    и

    0 0 0 x x x 2 1 0 (0 0 0 3 4 5 2 1 0).

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

Very interesting problems. I've never tried these 'within x% of an optimal solution' tasks.

Any tips on C and D (Div 1)?

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

    Problem D:

    If k = 1, answer is obvious.

    If k >= 2 answer is always YES. Let's do following.

    If n > m, rotate the field. Now n <= m. Let the horizontal equality/not-equality signs will be row conditions, vertical — column conditions.

    We will use only two colors. We will satisfy all row conditions, and at least half of column conditions.

    Suppose we had satisfied all row conditions, then we know for each row how it looks — there can be two variants of each row (variant with inversed 1 <-> 2). Let's color by rows. If we colored all rows till i-th, let's choose one of two variants of colorint i + 1 such way that we satisfy at least half of column conditions between that two rows (it's always possible).

    So we satisfy >= n * (m — 1) + 0.5 * m * (n — 1) conditions, that's >= 0.75 * total.

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

Very hard problem A. How to prove it? I submitted wrong solution, wrote a stress, realized that solution is wrong and... blocked the problem and get +700 points for the hacks.

If you do emulation for all positions where suffix of the first string is equal to the prefix of the second string, your answer will be wrong on this test:

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

    If current parity is 1, then add 1 at the end of a. Then start to make b just to the right — we always keep number of 1s at max as if we need to remove 1 it can be only if we need to add 1. After all b is built just remove any redundant prefix

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

    From every sting we can get string (cnt + cnt%2) ones. Just erase 0, and erase and add to and 1 if even ones, just add 1, if odd ones. It can be reversed to get any string from bigger number of ones.

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

    Let a be the original string and b — the final string. If parity(a) == 1, let's immediately append '1' to its end. Then let's append symbols of b to the end of a. If you need to append '0', you can just do it. Else, you need to erase symbols from the beginning till the first '1', and then append '1' to the end. So, you can transform a to b iff one_count(a) + parity(a) >= one_count(b).

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

    Although I realized correct solution for A too late (but I hope my solution is correct anyway), the idea is that if you have even number of 1's you can't make any more and if you have odd number of 1's you can add just one. And using this operations you can easily reorder 0's and 1's if there is a solution

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

Thank For Good Questions :) and i enjoyed polar beards :D

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

I've submitted problem B 3567559> at around 30 mins and then 10 mins before the contest ends was going to submit problem C but unfortunately submitted into problem B. Therefore pretest failed on test 1. So I resubmitted the same code of B 3575518adding one extra space in my code just before the contest. Both the submission of B passed pretest. .......:(( :((

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

start system testing pls!

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

Good Luck!

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

I was hacking someone's div2 D in the last 30s, but I accidently and unsuccessfully hacked his/her problem A instead.

I've never read his/her problem A, but I will be happy that the sys test will prove my hacking is right.

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

Does anyone fall to the trap in Div2 E / Div1 C that the original array is a unique array? (I do.)

The problem becomes really difficult when the original array is not a unique array.

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

How to approach div2:E/div1:C ?

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

I really liked this contest, especially those constant-factor approximation problems. It's something one cannot expect in other contests like TopCoder, Google Code Jam, etc.

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

    But today both problem C and problem D was in fact problems with exact solution, there was no need to approximate anything in usual way.

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

What the Contest! Div. 2

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

Thanks for the problems!!!

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

Hi guys, I just need your attention . A man who his name is Rado Asked me to give code of question C and he will give me code of A. He even sent me that code to convince me to sent him C. I didn't do that and I even didn't read that question. I also saw a blog that was about his cheating. they didn't do anything with him, but now plz plz help me to kick this cheaters out of CF. UP1: I send messages to Gerald and Mike but they haven't read it until yet.
UP2: MR.Mirzayanov send this message."Done, thanks." I have to thank him as well.

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

3565982 Почему это не работает?

Why it doesn't works?

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

    for (long i=a1-1;i--;i>=0)

    должно было быть

    for (long i=a1-1;i>=0;i--)?

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

Just have realized what was embarrassing me. The stars on the dark side of the moon on picture

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

зачем в задаче D(div. 2) дается k во входных данных?

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

    Чтобы массивы сортировать, а не увеличивать количество рыб k типа на каждом считывании.

»
11 лет назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится
Those bears were a real pain in the brain....
»
11 лет назад, # |
Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится

Hi, I can't find out why my fishes problem exceeded time limit. http://www.codeforces.com/contest/298/submission/3573315 Can someone with a keen eye spot what's wrong? Thx in advance.

Is there a way to get full test case data?

Confirmed. Same code in C++ worked under 360ms in the worst case. It's not first time when Mono compiler let's me down.

I have used shuffle before sort, as Dalex proposed elsewhere, and it ran under 140ms in C#.

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

Update the ratings so I can see myself everytime farther from division 1.

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

Is there a way to find the full case when the window shows "..." at the end? I failed case 49 of problem C div2.

http://www.codeforces.com/contest/298/submission/3573436

And while I already know the more elegant solution of using a simple formula, I'd like to know what went wrong.

Thanks,

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

Off topic: I'm experiencing a weird bug in google-chrome on 64 bit linux. On the right side I have a ruler with 2 arrows(one up and down) but when I press the up arrow it acts just like the down arrow. Anybody else experiencing this?

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

    I still don't know how those new comments arrow work, but I think they do act differently. Go to another topic, for example: http://codeforces.com/blog/entry/7361

    Here they seemed to me, as you say, to do the same. There I can see the (actually "a", can't tell for sure how it works) difference.

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

    I get the same behavior (chrome on ubuntu 12.04). However, it says "New comments" when you point your mouse at it, so probably that thing is supposed to scroll to the top/bottow of new comments at the current page.

    And if you're in the middle of the page, it will scroll you down, as all new comments are in the bottom.

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

Hey, can someone help me discover why my B (Div. 1) failed because of TLE. I have a regular solution — sort and use "two pointers" method. It usually works in under 100 ms, but takes over a second on test 33 (most likely infinite loop). So I probably have some bug in my code, but I cannot discover it.

Code: http://pastebin.com/ArKkCQe9

Thank you!

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

    I'm not sure about this, but if bi >= 0 and ai == -1, you might get stuck in your first if-else-if case.

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

      Oh, damn it! Added ai>= 0 && bi >= 0 to that clause and it passed. Thanks!

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

the contest for div1 depended on time too much(my mean is more for persons that accepted A and B)for example there were somebody that accepted A and B and with succesfull hack and their rank became so good while there were somebody else that accepted A and B with better time and spent the remainder of their time to the other questions and at last their score became less than the persons that got succesfull hack.and so it might be so diference between two persons that almost have the same skill(specially for persons that accepted A and B).so it will be better that the contest donot depend of time so much(of course it is my idea and my mean was for many contests not only your contest and also my words was a offer) at last thanks for the contest and sorry for my poor english .

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

    Agreed. The main reason is I underestimated the difficulty of problem C. I will try to do better next time :)

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

      thank you and thanks for your contests.also I really enjoyed of problem C. :D

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

      For me, it was more like not reading the words "unique" and "distinct"; I got the solution's sketch after noting that. A lesson to read the problem statement more carefully next time.

      It might also be useful to emphasize the word "distinct"?

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

I have some apokalyptically weird problem with my solution of D (Div. 2). I kept getting WA 1 sending the solution last minutes. It 3574362 says the code gives NO for the first pretest, but on my computer this exact code does give YES. I can't get it. Does anyone else have this problem?

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

I hope the editorial of this contest has no "coming soon..." phrase

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

Am I the only one who thinks why the moon in that picture is YELLOW?

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

Sorry if I missed this but will there be an editorial/when

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

Rating?

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

And tourist wins again, If anyone has the formula to be at least 10% like him please send it to me, I really need it not to quit programming right now...

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

Though I am an "antifan" of those kinds of constructive problems, I have to admit that solutions of C and D are so beautiful :)

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

Thank you for the contest! I liked the problems, they are more natural (as in "not too artificial") than a typical Codeforces problem.

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

Author master of greedy :)

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

first time to do cf,I felt very nice ,thank the aurthor.Orz tourist.:)

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

f**k zoe ~

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

The polar bears are very cute, and the problems are very interesting..

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

Surprised to see Chinese character^_^

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

Задачи с А до D были чисто на мышление. P.S. На счет остальных — я их не читал =)

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

Разбор в студию!