Автор awoo, история, 4 года назад, По-русски

Привет, Codeforces!

В 25.08.2020 17:35 (Московское время) состоится Educational Codeforces Round 94 (рейтинговый для Див. 2).

Продолжается серия образовательных раундов в рамках инициативы Harbour.Space University! Подробности о сотрудничестве Harbour.Space University и Codeforces можно прочитать в посте.

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 6 или 7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Задачи вместе со мной придумывали и готовили Роман Roms Глазов, Адилбек adedalic Далабаев, Владимир vovuh Петров, Иван BledDest Андросов и Максим Neon Мещеряков. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

Удачи в раунде! Успешных решений!

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

Место Участник Задач решено Штраф
1 neal 7 179
2 tmwilliamlin168 7 210
3 jiangly 7 235
4 kmjp 7 236
5 LayCurse 7 245

Поздравляем лучших взломщиков:

Место Участник Число взломов
1 orz 54:-1
2 anuragsingh804 31
3 Loveforever 20:-3
4 dapingguo8 16
5 celestialcoder 15

Было сделано 401 успешных и 778 неудачных взломов.

И, наконец, поздравляем людей, отправивших первое полное решение по задаче:

Задача Участник Штраф
A neal 0:01
B jiangly 0:05
C gleb.astashkin 0:07
D balakrishnan 0:06
E lebowski998 0:04
F rainboy 0:43
G rainboy 0:19

UPD: Разбор опубликован

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

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

0

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

Gladly waiting for div4 && div3 Contest..........

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

"You sleep while we work: due to technical reasons Codeforces may be unavailable on August 24 on time interval 21:00-23:30 (UTC)."

Ha ha, I am in UTC-7 timezone, so for me at this hour I am wide awake!

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

    West coast be like: Aww I have to wake up early for CF contests

    East coast: sleeps in until 10:25 and doesn't miss the contest

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

    You sleep while we work It's not a statement, it's an order.

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

    mike mirzayanov is from russia) so russians sleep at this time)

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

Codeforces is the best way to spend time in this pandemic

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

    In normal Div 2 ,weightage is different for all question, but in Educational contest weightage is same for all questions,and Ranking is based on penalty and no. of questions.

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

      Anushk-24 can you explain/elaborate this please?

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

        In the classic div 2 rounds you get a different amount of points for solving different questions. For example you get for A 500 points, for B-750,C-1000, and so on, but in the educational rounds this doesn't exist and you get one point for each question you solve. Also, in the classical Div 2 rounds you get less and less points for problems as time goes but in Educational round you get penalties.

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

    smh people changing comment content to avoid getting more downvotes

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

Finally...

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

In the recent Educational Round, I unable to have some positive rating. Expecting positive this time. Give me your wishes. Cross fingers.

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

Hoping to remain expert this time :)

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

Hope that queue does not occurs.

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

Can anyone please tell me what is the speciality of Educational rounds?

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится +8 Проголосовать: не нравится
    • Every question has equal weight-age
    • 12 hour open hacking phase
    • Some problems are standard/classical
    • »
      »
      »
      4 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      what it the meaning of "equal weight-age" ?

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

      Some more -

      • No "Failed System Tests" Disappointment
      • Takes a long time for ratings to change
      • »
        »
        »
        »
        4 года назад, # ^ |
          Проголосовать: нравится +16 Проголосовать: не нравится

        Actually there's a systest phase after the hacking phase(contains all successful hacks), and your solution might fail during that phase.

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

          That's true but people usually don't wait till that long and directly see the rating changes. That feel of "Running on Test Case X" is unmatchable.

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

Greetings to the Harbour Space university :D I think problem solver students in there are lucky to have this great community:D Always forward :)

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

Hoping for a positive delta :)

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

became pupil first time in last contest. Hope will maintain this status :)

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

Kudos to Team vovuh BledDest awoo for organising awesome contests.

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

wish me good luck

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

This kind of ordering?? You just destroyed me.

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

Problem B makes me rethink my whole life.

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

Felt B was even harder than D. Still, I am not sure about my solution. And I think I've seen E before on CF

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

The most disgusting codeforces round I have ever participate. B has misleading statement. C gives a useless and misleading range of x. E is an so old problem. The most bad experience.

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

    I have idea just now. I could have done this. That irritating B costed me. Disgusting round. Don't order problems in terms of difficulty

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

    What exactly is misleading in B and C statement?

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

      Many are confused in C for -1 condition !

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

        -1 is when there is no answer, and it is clearly stated in the output format. Figuring out when there is no answer is a part of the problem.

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

          why do u give an range of x by [1,|s|-1]. It is absolutely useless. If you want to make both w[i-x] and w[i+x] unexist, plz just make x in any range or a not such a range make some participants think it have some meaning.

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

      For B

      You don't care what to take, since each of them will melt into one steel ingot.

      But the question is to maximize the no of weapons, so it does matter what he chooses. The one with the lesser cost will give us more no of weapons.

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

        Bruh how can u get confused by this. If it stated how you maximize weapons it is giving u the answer.

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

      And so many participants think B as the most volume,just because you state that melt them. Why give such misleading statement?

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

        Well, there are two places where it is clearly written that we have to maximize the number of weapons (the output format and the last sentence of the statement), and exactly zero places where it is written that we have to maximize the weight.

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

          I think that such misleading statement dost not exists in most codeforces round I have ever participate. It is an online contest with tight time bound, we do not want to practice like an reading contest.

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

            I think you have lost your mind and cool:).... Take a break.... Because you need it... The problem setters got nothing to do with it if you read the problems in a wrong way... So just don't lose your cool buddy..

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

            I didn't find the statements misleading in any sense. And FYI, BledDest has written more contests than you have participated on Codeforces.

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

              sry,I participate codeforces contest for about 10 years. I complained because many participant got confused as me. U can have different view, but such attack is too naive.

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

                10 years? Your account history says otherwise..

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

                  First, I do not think this is the key point.But I can reply that I create new account after retired from ICPC. I think everyone have the right to comment a codeforces round. I played really bad in some past round, but I do not complain about it. I complained because this is the first round that I have ever seen that so much participants(maybe just in china around me) got confused with the statement. So I think I should let the round maker known what happened.

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

                  Yes, you're right. You do have the right to disagree with the setting of the statements, just as much as we do in telling you that you're slightly over reacting about the said problem statements.

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

                I bet I'm better than your 10 years

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

                  Plz do something to prove that yourself instead of bragging here. Maybe after ten years you won`t even be able to participant WF :)

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

How to solve E?

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

    448C - Painting Fence

    This is an exact replica of that problem. How lucky (and hardworking) I am to have solved it!

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

      that's why UpSolving is important... xD

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

      Is it? In tbat problem it says that you can paint a fence that has already been painted. And in E you cannot perform an operation if its range contains an element which is already zero.

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

        Yeah, but solving E is equivalent to solving Painting Fence because in the optimal sequence of Painting Fence, we never perform an operation on an already painted part of the fence. (Proof by contradiction)

        But the two problems are slightly different in the ranges of $$$a_i$$$. This makes Painting Fence a subtask of Problem E, but they are almost the same. (I used the same code for both problems because when I solved Painting Fence two months ago, my solution was a bit different from the editorial which incorporated $$$a_i==0$$$ part).

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

    dp[pos][k] where pos is the prefix we are at and k is the number of active 2nd type queries and gives minimum answer to make all elements till pos equal to 0

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

goodbye ratings.

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

How to solve Problem D?

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

    Iterate for $$$j$$$ and $$$k$$$, Now you need a index i such that $$$a_i = a_k$$$ and $$$i < j$$$, similarly, you need index $$$l$$$ such that $$$a_j = a_l$$$ and $$$k < l$$$, this suggests us to store two things.
    $$$1$$$. $$$pref[i][j]$$$ be the number of times $$$j$$$ appeared from $$$1$$$ to $$$i$$$
    $$$2$$$. $$$suff[i][j]$$$ be the number of times $$$j$$$ appeared from $$$i$$$ to $$$n$$$
    Now, rest is quite easy.

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

    There are only at max $$$n$$$ distinct numbers, so lets consider the case where each of them are used as $$$j$$$ and $$$l$$$, lets call this number the $$$divider$$$. So for each $$$divider$$$, we iterate left to right across the array, lets say the current number is $$$cur$$$. There are two cases:

    1. $$$cur$$$ $$$\ne$$$ $$$divider$$$ — Then we want to add the number of pairs for which this position is $$$k$$$ and some previous position of $$$cur$$$ is $$$i$$$, lets say it is $$$cnt_{cur}$$$. We'll add this to the answer and also store $$$cur$$$ in a vector with contains all non-$$$divider$$$ numbers visited (if its visited multiple times its stored multiple times). I'll explain how to calculate $$$cnt_{cur}$$$ in the other case.

    2. $$$cur$$$ $$$=$$$ $$$divider$$$ — Then we want to add all possible values which act as $$$i$$$ to their respective counts. Clearly each number in the vector we stored can act as $$$i$$$ if this position acts as $$$j$$$, so we just add 1 to $$$cnt_{x}$$$ for each $$$x$$$ in the vector.

    Also, we have to consider the case where all 4 numbers are the $$$divider$$$, but this is simply $$$cnt_{divider} \choose 4 $$$.

    Now since we're iterating over $$$n$$$ distinct numbers and iterating over the whole array in $$$O(n)$$$ each time, and operation 2 is clearly $$$O(n)$$$, it may appear as if the total complexity is $$$O(n^ 3)$$$. However we can observe that $$$cur$$$ $$$=$$$ $$$divider$$$ can only occur $$$n$$$ times over all iterations as each position has only 1 value. So operation 1 which takes $$$O(1)$$$ time is run $$$O(n ^ 2)$$$ times and operation 2 which has complexity $$$O(n)$$$ is run $$$O(n)$$$ times, so overall $$$O(n ^ 2)$$$ which easily passes.

    My submission — 90967360

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

    https://codeforces.com/contest/1400/submission/90950605

    I iterated for i and k and maintain some arrays which mean:

    lft[x]: how many x appears in the range [i+1,k-1]

    rht[x]: how many x appears in the range [k+1,n]

    cnt[x]: how many pairs of (x,x) with the first x in [i+1,k-1] and the second x in [k+1,n]

    Apparently, (cnt[x] = lft[x] * rht[x] ) always hold but we can't iterate for x (which cause TLE). But note that with the same i, we move k from k to k+1 will cause only the change of cnt[a[k]] and cnt [a[k+1]], so cnt[] can be maintained with O(1) and the solution is O(n^2)

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

How to solve B?

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

      Tried with that but WA

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

        Go from 0 to number of swords.

        In each iteration. You try to take i swords and if you can't all swords then give remaining to your follower.

        Now, take as much as axes you and your follower can with remaining weight capacities.

        Find maximum answer from all of them,

        Not so nice Implementation

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

      What kind of hint is it ? :)... It is also given in the statement(number of swords < 2*10^5)...

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

        Some people like me ignored it. After reading the problem second time I noticed that it is less than 2*10^5

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

          Okay Fine... But to be honest I laughed so hard on your hint.. and I am still while writing this comment... Great Hint:).. Don't take it personal man...

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

    The solution is greedy. First, if s>w swap them and the number of sords with the number of axes. Make a for from 0 to x axes that you take where x is the maximum available given, check if it's possible to take that many, then add as much sords as possible, then add as much axes as possible to your friend bag then add as much sords as possible to your friends bag. That's it!

    Link to my code: 90946553

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

B should be placed after C :(((

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

Copy pasted E from here

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

    :(

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

    The problem may seem standard but I am curious about how you found that EXACT problem that E was copied from

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

    I had also found this, but wasn't sure if they are same. Checkout the last condition in the link you shared. "Note that you are allowed to paint the same area of the fence multiple times."

    Is it the same, as I think we can't the operation in today's problem if not sufficient Ai for which we intend to do operation?

    Maybe I'm missing some observation. Please clarify toxic_hack

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

      Even if you are allowed to paint the same area of the fence multiple times, that would not reduce the number of operations needed.

      You will not need to paint it horizontally twice, because you would have combined the horizontal operation.

      Neither do you need to paint vertically twice for the same reason.

      After painting horizontally in the optimal fashion, there are no unpainted block under a painted block. There is no need for a vertical paint to go over a block painted horizontally.

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

    I Accepted 448C

    but I don't know E is the same as 448C,I'm fool ,lol.

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

Fucked-up-order-forces

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

Still waiting for the day I'll turn expert. (The grind is still on)

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

How to solve G?

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

    Inclusion-exclusion, answer is C(cnt[i], i) if m = 0 where cnt[i] is number of people j with l[j] <= i <= r[j]. If m > 0 then for each mask you need to calculate intersection of segments, and subtract\add C(cnt[i] — badCnt, i — badCnt) for L <= i <= R (badCnt is number of unique people in mask, [L, R] is intersection of segments). Since badCnt <= 40, you can precalculate it with prefix sums.

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

    Inclusion-exclusion on the subset of taken pairs of mercenaries that hate each other.

    Suppose that we fix a subset of pairs we take, this subset denotes the subset of mercenaries we have to take (up to $$$40$$$ of them). For these mercenaries, intersect the segments $$$[l_i, r_i]$$$ to get the range where the size of the subset will be (let it be $$$[L, R]$$$).

    Suppose there are $$$k$$$ mercenaries we have to take. Then we have to compute $$$\sum_{i=L}^{R} C(c_i - k, i - k)$$$, where $$$C(x, y)$$$ is the binomial coefficient, and $$$c_i$$$ is the number of mercenaries that are allowed in a subset of size $$$i$$$ ($$$i \in [l_x, r_x]$$$ for those mercenaries). The key observation is that $$$0 \le k \le 40$$$, so we can build $$$41$$$ arrays of those binomial coefficients and use prefix sums to quickly get the sum on range.

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

    I believe the crux was that max complete combos never exceeded 2^20

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

Can someone just give a hint for B?

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

Is Linear Diophantine Equation used for Question 2?

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

    No,It can be done without this theorem.

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

    You can draw a coordinate system in the form of linear programming. According to the slope, the answer must be one of the two endpoints.

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

Wrong Answer on test 2

Story of this contest

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

what is wrong with my code for C, plz help, i'm desperate and i can't find the mistake. 90982135

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

    plz help

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

    I couldn't understand that long code but here is how i upsolved it: First we only know that we will get a 0 only if there is no '1' on i+x and i-x indices. (Update both indices to '0') then, for each '1' in s, we check if at least one char either i+x or i-x is 1. if both are '0', print -1. else print 1's in all un-updated indices and updated will be '0' from the first step.

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

      tks, but i think i understand my mistake, i should have initialize the answer with all ones.

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

        Seems like that wasn't the only mistake. I'm no expert but i think that shorter code like this is easier to debug.

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

isn't E divide & conquer dp?

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

    Yes and it's actually pretty easy.... Almost solved in during contest and feeling regretful now...

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

Thanks for the best B ever. Must say it was a bit humiliating when i started solving it first but it turned out to be the best decision of my life when i decided to move on to C rather :) .

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

I found B very interesting..

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

    shouldn't have wasted that much time on B, C was waaayyy easiear and doable than B.

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

      Yup,I also wasted a lot of time in B ,since I thought that problems are in SORTED order...

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

Can someone give any hints for F?

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

    The total length of $$$x$$$-prime strings is not too big (somewhere around $$$5000$$$), so we have to generate them, build an Aho-Corasick automaton and implement the following dynamic programming: $$$dp[x][y]$$$ is the minimum number of characters from the first $$$x$$$ we have to remove, so the resulting state in the automaton is $$$y$$$ (make sure to mark the bad states of the automaton, that is, the states where some prime string ends).

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

      Haven't really heard some of the terms you used. Guess this problem wasn't intended for me to solve. Appreciate the reply BTW :)

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

Hi all, can u help me? Sorry, I bad at English.... https://codeforces.com/contest/1400/submission/90954904

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

4 Times "WRONG ANSWERE ON TEST 2"...

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

This contest has been weird-order-forces, greedyforces, and WA on Pretest 2-forces.

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

Can anyone tell me what's wrong in my approach for C. I created the original required array(say arr) by using the conditions in a reverse way, then I created another array using those conditions in a given way array(say s2) By using arr. Then I checked if the input string (say s1) is not equal to s2, the answer is -1 . Else print the array (arr). my WA

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

Problem D looked like a standard interview problem.

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

What is the point of naming questions A, B, C when they don't represent the difficulty level? Just do it the CodeChef way if you can't order properly, it wastes a lot of time.

That being said, definitely a great education contest.

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

How to solve Problem B ?

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

So, now my believe that they sort problems in terms of difficulty is broken. Thanks!

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

In fact, question E is the same as the question 448C You can use the code from question 448C to pass E.

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

Why is this code wrong for C?

Please help (if possible provide correct logic of C)

#include<bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin>>t;
    while(t--){
        int x;
        string s, w;
        cin>>s;
        cin>>x;
        for(int i=0; i<s.size(); i++){
            if(i+x<s.size() || i-x>=0){
                if(s[i+x]=='1' || s[i-x]=='1') w[i]='1';
                if(s[i+x]=='0' && s[i-x]=='0') w[i]='0';
            }
        }
        if(w.size()==s.size()) cout<<w<<"\n";
        else cout<<-1<<"\n";
    }
    return 0;
}
  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    i guess that you access string w out of bound?

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

    I think you should check conditions i+x<s.size() and i-x>=0 separately.

    In your code, when i=0, i-x<0 but i+x<s.size() -> you access character at a negative (i-x) position in string s.

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

i submitted my solution when very few seconds were remaining (usually when contest is over then a small rectangle appears saying contest is over but this did not happened in my case when i clicked on submit) . But my solution did not got submitted. What could be possible reasons ? can awoo or MikeMirzayanov look into it.

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

swap(B,C);

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

When can we expect the editorials? Eagerly waiting for the explanation for B.

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

    Iterate on $$$i$$$ — the number of swords you take, then you can compute the number of axes you take using a simple formula in $$$O(1)$$$: $$$\min(cnt_w, \frac{p - is}{w})$$$. Then compute the number of weapons your buddy should take: if the swords are lighter than the axes, then the buddy should take the maximum possible amount of swords he can, and then — the maximum number of axes. Otherwise, it's vice versa.

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

      I tried first taking as many swords as possible for F and then removing each sword and getting axes in place(only if I can) and then decreased the count of respective weapons and then performed same thing for P and then combined the results.

      I saw many of test cases for this solution correct but many were close but not exact? What's wrong in this approach?

      PS:- I understood your approach. Thank you.

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

        Hey man! If you find an answer to your question. Please let me know. I did the same. Don't know why it's wrong to do that.

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

The question E was an exact copy of /problem/448/C. why?

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

Why is it giving MLE on E?

I created a 3-d vector ( n * n * 2 ) of ints

Technically, 10^8 vector of ints gives ~ 4*10^8 ~ 400 MB,

So here it is 4*(5000)*(5000)*(2) = 2*10^8, which is roughly 200 MB, and constraint is 256 MB!

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

    Are you using long integers?

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

      no I changed it to integers, after 1st attempt, still MLE

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

        Still 200 is pretty close 256. And I see you are using vectors. Vectors sometimes take a bit extra space than you assign them.

        Maybe array won't give MLE

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

          thanks, it worked with the array. still curious to know the factors affecting the MLE part. bcoz I had approximated 1MB to 10^6 bytes, but it is 1024*1024, which provides even more space than 2*10^8 bytes.

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

            Read up on how vectors work. A vector is alloted extra space than the size you declare it to. This is to support the pushback operations in constant time. When the actual capacity is reached, the size alloted is doubled I think.

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

            vector makes more cells than it actually has, because it can expand

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

Poor me couldn't solve C. Could anyone explain it a bit?

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

    First initialize s (length n) with all 1's.

    Traverse on string w. For all 0's in w set s[i-x] = 0 if i-x>=0 and s[i+x] = 0 if i+x<n, where i is the index of a zero.

    Check if the final string s is correct. If it is print it else print -1. You have to check if it is correct because you changed some cells' values from 1 to 0 in s. So you have to make sure that all the 1's in w are valid.

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

Contest is very interesting.... Thanks...

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

Damn, I didn't read problem E correctly (or I forgot the details). I thought we had individual numbers given and not the numbers of each specific number....

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

Why don't you guys announce officially that problems won't be sorted according to increasing difficulty. And I think gone are the days when the problemset used to consist of problems with varied difficulties. It's really frustrating taking part in such contests.

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

why will binary search not work in problem B.

I was trying like this if you can take 'mid' number of total swords then you can take any number of swords less than 'mid'

to check mid we will take that kind of sword which is cheaper first and then rest of the other type of sword.

Submission : https://codeforces.com/contest/1400/submission/90957831

please help

upd: i got my silly mistake

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

Swap B and C :)

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

can somebody please help what is wrong in my code in div2C ,i just changed some if's and it got accepted thanks in advance WA CODE Accepted Code

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

Alternate Solution to B:

Suppose item of type 1 costs lower than type 2 ( if both are equal choose arbitrarily). We first determine if there is an optimal solution which does not use all the type-1 objects. Consider any optimal solution S*. If S* has some type-2 objects, replace them by type-1 objects until there are (a) either no type-1 objects left, in which case we conclude that there is an optimal solution which uses all type-1 objects, or (b) We obtain an optimal solution consisting only of type-1 objects, which, further, does not use all type-1 objects. But (b) happens iff floor(p/weight_{type 1}) + floor(w/{weight _type 1}) < cnt_type 1.

If (b) happens, then the optimal value is simply floor(p/weight_{type 1}) + floor(w/{weight _type 1}).

Otherwise, all the type-1 objects are part of an optimal solution. Now we iterate over the number of type-1 objects that one of the persons takes as part of the optimal solution, we can then figure out the remaining capacities of both persons and update the answer accordingly.

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

Someone please explain how to solve problem D.

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

    deleted

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

    Let's take all possible values of j and l, so we need to find possible i and k. How do we do that ?

    Spoiler

    But it's a tle. So how to do it effectively.

    Spoiler

    I think the code should be readable now. 90963741

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

      Nice explanation :)

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

      Was D a standard approach? If it was, what is this thing called?

      Ps: I know it is an optimization to the brute force and hence can be called DP, but I wanted to know a more specific term than DP related to this problem (if any)?

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

        Well I am not sure for the standard term, I can relate it to "contribution techniques". A recent problem which uses same kind of technique can be found in Codechef August Long Challenge,( Subsequence frequency counting ).

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

anyone please help what's wrong in my code in problem C( giving wa on test#2)

https://codeforces.com/contest/1400/submission/90994456

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

For problem C, will checking if the character is 1 instead of checking for 0 and transforming be wrong ? Hard to explain but here's the code WA Solution

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

    u should check the 0 first since its obvious, if you check the 1 first, its hard to handle as there can be 2 positions for 1

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

Wow the problem e was in a other contest its exaclty the same problem as this "paintinhlg the fence"

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

In question c, I did not consider that when i-x and i + x are both out of bounds, s[i] must be zero. It is a sad story. I think there should be many people like me.

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

I have an nlogn Solution to problem E(nlogn preprocessing and O(n) recursion) ..

https://codeforces.com/contest/1400/submission/90992471

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

can some one provide small counter case in my problem c submission

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

    Accepted

    I don't know what exactly the mistake was but it was something with reinitializing values.

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

      I am not initializing anything if you notice . Just see these two codes , the only difference is that i am declaring string outside the loop and in the other inside. wrong answer

      accepted

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

        problem is with the way you use resize() function. temp.resize(n+1,'1') will not change the value of whole string to string of '1's. Ex. if temp="001" then it will become "00111" after temp.resize(5,'1').

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

WOW why no one mention that the problem E was the EXACT problem as "painting the fence" problem. its actually the same problem!!! this is the link of that problem https://codeforces.com/problemset/problem/448/C

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

For problem F, it says in the notes for the first example that

The resulting string "1162317" contains no 8-prime substrings.

But here "62" and "17" are also 8-prime substrings, right?

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

    In the 2nd condition with the $$$[l_2, r_2]$$$, $$$x$$$ can't be divisible by $$$f(l_2, r_2)$$$. For those substrings, 8 is divisible by 2 and by 1.

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

Can we solve D if the array were circular? For example, take n points around a cirlce. Each point i has a value $$$a_i$$$. Join points which have the same value by a straight string and then ask for the number of times two strings intersect.

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

    Wow. Another perspective to look at the problem.

    This perspective would be helpful in creating another problem with the same solution.

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

my solution for E just got hacked, https://codeforces.com/contest/1400/submission/90994198 can someone help me to find the mistake?

  • »
    »
    4 года назад, # ^ |
    Rev. 2   Проголосовать: нравится +5 Проголосовать: не нравится
    if(n==1)
    return 1;

    This is not quite correct. If array has length 1, but its only element is 0, then the answer is 0. After reading your code I think it's impossible for your code to pass an array with 0 to this function recursively, but you can be given such array on the input.

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

Is n^2logn allowed in D , many submissions are passing Extreme cases with 1990 ms.

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

URGENT If i submit a solution from 2 different accounts will both of them will get skipped?awoo

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

problem E felt much easier than problem D... Could it be because problem D is a well known problem? Because I looked at some solutions and they seemed very tricky. I mean, I reduced it to the number of "pure" intersecting sub-segments so maybe that's well known? I don't know...

If it is a well known problem, I can say that even though they consistently screw my ratings, these EDU rounds are so important to get familiar with non-ad-hoc problems and their solutions.

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

Even though C has a very simple understandable solution. Did anyone thought of using Two Sat to solve the problem during contest ? It is a very direct application of Two Sat.

Spoiler

You can check my submission here 91000892

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

Can someone hack my solution for D, the time complexity of my solution is $$$O(n^3)$$$.

Link: https://codeforces.com/contest/1400/submission/90999462

Edit: It's $$$O(n^3)$$$

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

    Your solution actually can take up to $$$O(n^3)$$$ on a test like

    1
    3000
    1 2 3 ... 1000 1001 1001 ... 1001 (total 2000 occurrences of 1001)
    

    Due to how unordered_map works, occurrences of 2001 will be stored in g[0],

    so

    int c1 = fre[y][g[x][j]] - fre[y][g[x][i]];
    int c2 = fre[y][n] - fre[y][g[x][j]];
    int c3 = fre[y][g[x][i]];
    ans += (c1 * (c2+c3));
    

    this piece of code will be executed for all $$$y$$$ in $$$[1,1000]$$$, for all $$$0\leq i<j<2000$$$, which is total of 1999000000 times.

    Fortunately for you your solution has a very low constant factor and runs on this test in 1699ms so I don't think it is possible to hack it.

    At first I thought compiler somehow realised this loop is somewhat redundant and optimised it into just adding the same thing x times, but no, when I run it on similar test with $$$n = 6000$$$ it did take approximately $$$8$$$ times longer

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

      I most-probably hacked 30 submissions using maps , unordered maps and custom hashes. and I hope if my test case is added then his solution may time out. PS:- My test can't stop compiler optimisations thus I don't think the submission will timeout.

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

        No it won't. The part using hashmap does $$$O(n)$$$ operations on it, so even if you defeat it, which is impossible given that those operations operate on keys from [1, n], they'll take $$$O(n^2)$$$ which is still very fast with $$$n=3000$$$.

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

          Ya I came to know it after seeing that pragma , in his submission. And I think that pragma should not be allowed in real to use. As it is just allowing some brute approaches to pass. Anyways its my opinion.

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

I worked out E by greedily picking min_element and recursively solving the subproblems on either side of it. Can someone provide the proof of optimality for the approach?

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

    The recurrence comes down to $$$T(n) = T(n-i) + T(i) + O(n)$$$ where $$$i$$$ is the index of the min element. Worst case is $$$T(n) = T(n-1) + O(n) = O(n^2)$$$.

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

    You want to take the longest "horizontal" interval because if you take two overlapping intervals, you can always replace them with their union and intersection (for example if a = {1,2,2,1}, you can take the intervals [0,2] and [1,3], but you can replace those with [0,3] and [1,2]).

    So, you keep taking the longest one as many times as you can, which happens to be min_element times.

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

    What you guys said is right in itself, but it doesn't justify optimality, I think.

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

      The first observation is that the order of the operations doesn't matter. Consider some element $$$i$$$ frequency $$$a_i$$$. All the operations acting on $$$i$$$ need to sum up to $$$a_i$$$ (op 1 has the effect of $$$+1$$$, op 2 has the effect of $$$+x$$$). Since addition is commutative, the order doesn't matter.

      The second observation is that it's always better to do a single op 2 on any $$$i$$$. Two op 2s $$$(i, x_1)$$$ and $$$(i, x_2)$$$ can be replaced with a single $$$(i, x_1+x_2)$$$.

      The third observation is that the intervals for any two op 1s can be replaced by their union and intersection (as described by Svlad_Cjelli above). This means that if you have some set of intervals that overlap to span a range $$$[l, r]$$$, then you can replace the intervals such that you have an op 1 that spans the whole range.

      Now for the greedy strategy. By the first two observations, we can end the algorithm by perform $$$r-l+1$$$ op 2s on the remaining elements. Otherwise, we need to perform some sort of op 1. Using the third observation, we can greedily pick the largest range possible.

      Where does the min element come in? If you use the greedy strategy above, then doing $$$< a_{min}$$$ op 1s followed by the $$$r-l+1$$$ op 2s is never better than doing $$$r-l+1$$$ op 2s from the start. However, once we reach $$$a_{min}$$$ op 1s, we cannot do anymore op 1s over the full $$$[l, r]$$$. Hence, it breaks down into the left and right subproblems.

      Therefore, the final greedy algorithm $$$solve(l, r)$$$ is the minimum of:

      1. $$$r-l+1$$$
      2. $$$a_k + solve(l, k-1) + solve(k+1, r)$$$ where $$$a_k = min(a[l...r])$$$
»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

C is confusing.

For a given $$$i$$$, such that $$$i-x > 0$$$ and $$$i+x <=N$$$, should $$$s[i-x]$$$ be equal to $$$s[i+x]$$$? From the problem statement it seems so. Otherwise $$$w[i]$$$ is not defined, since it should be equal to both $$$s[i-x]$$$ and $$$s[i+x]$$$.

But from looking at the solutions, it doesn't seem to be the right interpretation. What is the right interpretation of the problem statement?

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

    If w[i]==1 then s[i-x] and s[i+x] must be equal (to 1). But if w[i]==0, then one of them could be 0 and the other one could be 1.

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

I think this round is "hap"py and not "happy".:(

I can't solve E(T_T),I'm so weak!

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

.

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

    It seems that D is not a original question either.Will this contest unrated?

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

Please explain why problem E is exactly the same question as 448C - Painting Fence. And will this round be unrated because of this mistake?

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

E was used in Tencent(腾讯) coding test of campus recruiting a few days ago.

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

In E.Clear the Multiset can anyone explain me how we get the output as 3 instead of 2.Thank You! input 5 1 0 1 0 1 output 3

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

    We need to clear $$$a_1,a_3,a_5$$$ (They are all equals to $$$1$$$) separately, so we need $$$3$$$ operations. How did you get the answer $$$2$$$?

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

deleted :(

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

Why does a iterative solution not work for E? I try to find the minimum value in every contiguous segment with value >0, and reduce every element in the segment by the min. value, I keep doing this till all elements are not 0

91013729

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

Hi, please somebody help me debug this code for problem B. I have been trying to find the bug but no success. I am first iterating over all number of swords we can take ourselves, and then giving the remaining swords to follower. Axes fill the remaining space for both.

MY CODE

Thanks in advance!

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

    loop on l from 0 to p/wgts should be upto min(p/wgts, cnts) because otherwise cnts-l can be negative.

    Testcase:

    1
    16 12
    2 4
    4 5
    

    expected answer : 5 your output : 6

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

Why doesn't the system test start?

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

Is it rated?

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

Is it rated?

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

Why the rating for this round is not given till now?

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

As far as I know, E is similar to 448 C, so, will this contest rated for div.2?

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

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

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

C was easier than B.

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

What does +,+1,+2,+3 mean in the standings page? Can anyone explain?

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

    Number of penalties (incorrect submissions) that person received for that question.

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

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

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

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

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

Can anyone send me more problems like RPG PROTAGONIST i would like to practice more of them.

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

    If you means problem with both brute force and greedy,1389D is pretty good.