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

Привет, Codeforces!

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

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

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

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

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

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

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

Место Участник Задач решено Штраф
1 dzh_loves_mjy 7 204
2 neal 7 231
3 WZYYN 7 250
4 noimi 7 357
5 Um_nik 7 384

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

Задача Участник Штраф
A Kirill22 0:01
B dzh_loves_mjy 0:04
C SSerxhs 0:05
D gleb.astashkin 0:17
E Pigbrain 0:19
F WZYYN 0:54
G OnlyG 0:16

UPD: Из-за проблем с задачами А и B раунд нерейтинговый.

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

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

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

.

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

    lol the rounds unrated. hope you get it next time tho!

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

      .

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

        even I had 1377 was hoping to go back to specialist ,had even solved two questions real quick but never mind

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

          Ohh, so you managed to solve A?

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

            yeah xD knew my logic was right and when they corrected it I confirmed with given output and submitted

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

              can you explain the logic please?

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

                look at how many sticks there must be, from that you can convert some to coals to have at least $$$k$$$ sticks and $$$k$$$ coals.

                $$$\lceil{\frac{k+yk-1}{(x-1)}}\rceil+k$$$ is the answer

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

                  t = int(input()) for i in range(t): x,y,k = [int(x) for x in input().split()] ans = (k*y) + k count=0 count = m.ceil((ans-1)/(x-1)) count += k print(count)

                  this is the ans i submitted, but i got wa

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

                  I had the same issue. I think the ceil function does not work properly for long long numbers.

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

                  include<bits/stdc++.h>

                  using namespace std; int main(){ long long int t; cin>>t; while(t--){ long long int x,y,k,c,d; cin>>x>>y>>k;

                  c=(k+y*k-x)/(x-1);
                  d=(k+y*k-x)%(x-1);
                  if(d==0)
                  cout<<c+1+k<<endl;
                  else cout<<c+2+k<<endl;
                  
                  }
                  

                  } whats the prob wid this code?

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

                  When x>(k+y*k), we need to print k+1 as you will exchange one stick for x sticks and k sticks for k coals.

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

                  thank you so much. It got accepted

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

                  NoobM, shaded I had the same issue. And you are right python's inbuilt ceil function and as a matter of fact square root function does not work properly in case of long long numbers.

                  So, to solve this issue I found out a solution on stackoverflow. To find the ceil value of division of a by b you can simply do -(a//(-b)) in python and -(a/(-b)) in C++, i did this and got AC.

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

                look you have 0 coals so you will need k steps for k coals.Now as for the sticks you need k sticks to match the coals for conversion into torch.You also need k*y sticks extra so they can be converted into coals later.So, total you need to add (k*y+k-1) sticks extra(since you already have one stick). Now in every trade for sticks you gain x-1 sticks,so, number of steps required is :- (val/(x-1))+min((int)1,(val%(x-1))) where val is (k*y+k-1). So,total no. of steps is (k+(val/(x-1))+min((int)1,(val%(x-1))))

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

Just curious to know, How they have such a large collections of problems?

they are soon going to make century of educational rounds

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

before: educational so unbearable will again be one math

Now: wow they are doing really interesting rounds of course I will write it

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

Hope I will get some increase today...

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

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

A

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

    There has been bad incidents in the past( Long queues, round being unrated, pretests weak/wrong) whenever some author didn't thank Mike. So nobody wants to take the risk you see XD

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

    Mike unlinke Mark doesn't sell your data, maintains ad free site, we get quality problems completely free of cost, and without watching any ads like SPOJ. People thank Mike out of gratitude for him.

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

Wish me luck, please!

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

Let's go!

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

Just curious to know, we don't have any problem tester in educational rounds? Or is the same set of people involved in testing the problems?

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

I hope it has strong pretest and interesting problems!

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

I would like to know which debuging tool are you using? Oh, I suddenly realized that we don't need in cf :D But I still want to hear suggestions

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

Purple Rain

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

Hey, this is my first time participating in the educational round and I have a simple question. I quite can't grasp the idea of the time penalty. (I searched up the rules but I still don't get it.)

To the best of my understandings, is it one of the followings? 1) the final score is directly related to time consumed 2) total time of 2 hrs gets shorter by 10 minutes for each wrong submission

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

    Let's say you submitted 2 source code.
    Submission 1: got the WA at 00:03
    Submission 2: got the AC. at 00:07

    Then you get just the same score who got the AC at 00:17.

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

All the best Guys, noob here hope i will make some score today..

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

Can I join a contest in codeforces after it has started ??

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

This contest is a nightmare.

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

so sad that this round will be unrated after all the effort to solve the first few problems

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

Thank God! It got Unrated.
Problem A made me feel so worthless today.

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

Back to UnratedForces...

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

problem A was so irritating before:( now it is good:)

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

Please let this round rated back :((. Just a small issue from the problem A right ?

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

    Not a small issue for those whose schedule and timing of the contest is completely ruined.

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

It was obvious that round will be unrated when I saw those wandering trader deals.

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

It's unfortunate that the negativity started in the comment section, in particular this comment has eventually cursed the round and a good problemset. :'(

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

But i was doing so well :((((( Screen-Shot-2020-09-14-at-6.05.09-PM.png

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

Out of curiosity how did whatever mistake happened slip through on A? It seems to have been a major error considering that all the samples itself were wrong.

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

    Anyone got it right when the data was not changed?

    I made the same mistake and passed all tests when the sample was not changed. Maybe the testers said "Hey, how could there be bugs in A?" and simply let it slip thru.

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

      I submitted within a minute of the change, there were 800 submissions by that point. There were 400-500ish before that.

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

    really wonder how this obvious error can be passed in Polygon...

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

      Yeah, I would expect that there should have been at least a "should TLE" brute force. Moreover how did it pass testing? Did all the testers make the same mistake? Frankly this makes me think that educational rounds don't actually have a testing phase.

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

I thought for a long time why the test case came out like this.

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

They should explain the sample test case of first question.

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

Damn these unrated rounds. Ruined my first contest.

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

I feel really sorry for setters. They have make good problemset using a lot of efforts. Contest has been ruined only by A problem.

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

awoo Were there testers in this round??

and how to become a tester of the round I'm just curious to know.

and thank you for the answer

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

Does anyone check the correctness of the problems????

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

Unrated round because of a simple maths problem. Sad for setters and competitors, there should be a tester in edu rounds

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

This is pretty sad. Even if educational rounds don't have testers (which they should), can't you at least have more than 1 person write model/correct solutions? I know how polygon works and it's not very hard to simply ask someone else to upload another solution and find any mistakes, especially in problem A.

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

WHY UNRATED? IT WAS THE EDUCATIONAL ROUND IN WHICH I COULD HAVE IMPROVED MY RATINGS. WHY THIS ALWAYS HAPPENS WITH ME.GOD! AM I THAT BAD?

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

Does anyone check the correctness of the problem A??? Bad experience!

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

Im sad because problems B and C were cool, usually I dislike them, but in this contest they were pretty nice :(

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

Sorry, looks like its only my problem

DELETED

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

    this is the problem D screenshot from my screen, just notice to word "piles"

    also i asked some of my friends and they had same problem

    BTW, if you don't have this problem, sorry for unrelated comment

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

Leaving aside A, other problems are very interesting, do give it a try guys :D

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

    But it is no point for me to stay overnight now... I've refrained from staying up for three days in preparation of this contest

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

      wow, that sounds so inspiring, but don't worry your hard work will pay off in the next contest for sure :D

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

Damn that was the first time I've solved 2 problems in 20 minutes. But... it's unrated. So sad.

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

hello everybody. I'm curious to know how to become a tester of the round. if there is a link or description about becoming a tester of the round please leave it under this comment. thank you.

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

Please don't keep sample tests unexplained even if its problem A.

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

    I think the author could have realized his mistake had he written the explanation of the sample tests once.

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

Can we please have a div3 at least until saturday?

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

Can you please explain the test case 3 for problem A,

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

(44wfcm.png)

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

    Tbh, problem A is pretty easy just like normal A's a simple one line formula for AC, only difference is, they messed up the sample test cases which made it a lot confusing, adding on to that they didn't provide any explanations.

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

Every other educational round:
me: if I can't solve B I definitely can't solve C.
them: we shall make sure you don't solve B.
me: end up solving just A.
Today:
me: solves A & B in under 20 minutes.
them: unfortunately this round will be unrated.

P.S: I know the frustration is higher for the writers when a round becomes unrated, so feeling sorry for them too.

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

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

I wrote 2 codes for problem B they gives same output to sample but one of them passes the sample one of them don't but they gives same output for output but when i submit it says wrong on this sample input why?

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

Before the samples of problem A were fixed, there were already about 1K submissions. I wonder what solution they submitted?

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

    Can I tell it now? I made the same mistake.

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

    None of them did add the other operation and it was more likely that no one added.

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

    Maybe they did so without seeing the sample testcase and worked it on their own... I have seen many coders do that maybe out of competition or confidence

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

      If the jury's mistake was: the statement says you should count both type of operations or at least is ambiguous so it can be interpreted this way, but model solution counts only one of them, then IMO it's a little weird decision to change the tests rather than just make an announcement like: "you should count only operations of type 1, we have updated the statement to make it clear".

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

        It was worse than that as far as I understand

        The jury's solution also had a rounding error. So they couldn't just correct the statement the way you suggest

        This was the accepted solution at the time of the round

            need_sticks = (y + 1) * k
            cnt = (need_sticks - 1) // (x - 1)
            print(cnt)
        
  • »
    »
    4 года назад, # ^ |
    Rev. 3   Проголосовать: нравится +22 Проголосовать: не нравится

    I adjusted my solution to the samples without much thinking when I saw that it does not match the result. Added incorrect rounding and omited the second operation.

    I thought "I don't have time to think about it, will figure out why it has to be this way after the contest"

    And then I had to return everything back...

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

Did a rejudge on B just happen? Some people's Bs got converted from pretests passed to WA on pretest 1.

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

problem A likes a nightmare

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

I am just curious, How is it happen. Is both setter and tester got the same idea for the solution.

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

Problem A like a nightmare:(

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

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

this is what happens when you push code to production without writing unit tests

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

This contest is really cursed.

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

When I found the problems easy and solve them fast, the round became unrated. Bad luck for all :(

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

What a stupid contest !

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

there should have been testers for the round , as 2 problems had issues in them.

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

Didn't anyone test this pre-test?

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

is the round unrated?

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

The contest problems were good enough but only problem was with the checker.Enjoyed problem solving

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

Waiting for announcement regarding Problem C

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

Every time I perform little better the contest gets unrated. ;__;

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

now as the contest is unrated , will there be a hacking phase or we will go strait up to system testing?

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

Every time I perform little better the contest gets unrated. ;__;

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

BledDest for preparing A & B ? Still remember he writes his checker by casting INT to BOOL.

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

 ;(

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

I think there is a wrong output in Problem B 4th Case:

Your ouput: -4 0 1 6 3

p=[−4,−4,−3,3,6]

k=3 But i have better Solution:

1 0 -4 6 3

p= 1 1 -3 3 6

k=1.

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

I didn't read comments . Now I got to know the round is unrated.. __

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

Couldn't even solve one complete question. Need a lot of practice for me. Any good resources and motivation to learn more about competitive coding.

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

    It is OK, go to the problem set sort the problems by difficulty and start practicing with the easier ones, you will be able to solve A problems in a short time

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

Problems were outstanding. But, A's sample test ruined it :(

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

Very sad to know that the round is unrated after I tried so hard to solve D&E..

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

Rating is just a number. The problems were interesting and instructive. Thank you all problem setters!

Waiting for the editorial.

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

Thanks to GOD that the contest was unrated....... The problems are hard and hard to understand.......

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

I'm really sorry about the issue with the problem A. This was completely my fault. I re-checked the formula yesterday and discussed it with others and nobody found any mistakes.

1) I didn't round up the result of the division.

2) I forgot about $$$k$$$ trades you need to get coals.

So, my solution was completely incorrect. I will not blame anyone else because this was my problem and I failed its preparation. I didn't want this round to be unrated and this issue right at the start of the contest just completely ruined me. Sorry guys.

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

    its ok, human are not perfect

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

    aw man

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

    Mistakes happen. You are a great problem setter. I've always liked your problems <3

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

    It is OK man, it is kind of encouraging for us beginners to see that even strong coders sometimes make mistakes in problem A ;-)

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

    wouldn't it be nice idea to extend the time of round by 10 more minutes instead of making it as unrated, because the problems are extremely good , feeling sad for this round becoming unrated

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

      Sadly, if the first problem is wrong, it affects almost anyone. And also this was not the only issue because the checker of the problem B was incorrect. Cursed round. Really cursed.

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

    Well mistakes do happen, but the problem itself was good.Just curious how did it slip away from testers?

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

    This is a pretty bad mistake, but you handled it pretty well during the competition and now by admitting to it. I'm surprised that nobody noticed the issue, did anyone actually solve the problem (in code) other than you?

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

      One person solved it before the contest. Sadly, he just tried to find the formula which passes the example. This is fun and sad at the same time.

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

        Well don't you think it's a good idea to have multiple testers on every problem regardless of its difficulty? If testing status were always like this, this situation were bound to happen.

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

          There are reasons Educational Rounds are pretty rarely tested and these reasons almost don't belong to me. Moreover, I'm pretty rare guest in Educational Rounds now because I'm mostly busy with Div.3.

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

            That's kinda sad to hear. One might expect sponsored rounds to be more prepared than the regular ones but it sounds like it's not the case.

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

    But i am surprised to see about 700 people solve the problem before correction. Looking at this i thought i might got something wrong.

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

    No rated contest should have problems that are not stress-tested with a naive slow solution.

    But yeah, shit happens.

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

Problem D — For input [1,3], we move 1 to 2 and 3 to 2. This makes both of them together.

Kindly correct me, if I got it wrong !!

Can anyone explain the test case [1,2,4,8,9,100].

How are we moving the piles to make them together?

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

    for [1,3] you just keep each one in its place. The problem says to put all of them in at most 2 piles, not necessarily 1.

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

    For input [1,3] the answer is 0, you can leave them at their original positions because you need at most two piles

    For case [1,2,4,8,9,100], you move all the piles except the one at 100 to position 4, which takes 8 moves

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

It seems C was like 1400 and D 2000

Still, sad that it is unrated

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

    D was simple with set and multiset. It is O(q*log(n))

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

      I wonder if my solution is overcomplicated or I just suck in c++. I couldn't come up with a solution with datastructures available in python and had to implement it in c++

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

      use

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

      In the end my estimate was nearly perfect and off by 100

      Though it maybe affected by the fact that the round ended up unrated

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

The problems were really interesting, so unfortunate it became unrated, just curious, how the problem A thing happen? all samples were wrong.

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

Will this round be unrated?

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

I admit it is fair to unrate the contest because of the issue of problem A but I still feel unhappy because I get a pretty good result.

Anyway, thanks to the problem setters. Bad things happen all the time. Do not worry about it too much.

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

Man, Can't catch a break.

cf.jpg

I do feel bad for Problem Setters though. The problems were definitely good.

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

Best channel for video editorials of this round and all other rounds :- https://www.youtube.com/watch?v=Q76hY9VMHdI

Also , codeforces shouldnt do this to programmers . They should check their programs before the round .

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

awoo I know this doesn't come under rules but is it possible for you guys to discard the hacking phase as the round is unrated it won't affect much and we don't have to wait for the editorials.

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

    They could post the editorials if they want to, it does not depend on the hacking phase.

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

Honestly, did not liked the problems much. A, B, C where long and fairly unclear statements. D was long, too, but at least clear.

E, F, G might be to hard, I assume less than 20 rated participants would have solved any of them.

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

    Just noticed that I missunderstood D, it is not that we can move at all positions x, we can move all objects at one position x. So this is is shitty misunderstandable statement, too.

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

Did D have some elegant implementation? There was too much case work in my solution.

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

where did we receive notification regarding making round non rated?

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

Can anyone explain how to solve G because the question was pretty straightforward ??

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

How to solve F and G?

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

    F: Fix $$$d = gcd(x_1, x_2)$$$ where $$$x_2$$$ is yet to be determined, also the condition $$$l \le x_1y_1 \le r$$$ gives some bounds $$$L \le y_1 \le R$$$.

    If $$$x_1 = dk$$$, $$$x_2 = ds$$$ then we need $$$s \mid y_1$$$ and $$$k < s \le \frac{n}{d}$$$. We have two cases:

    1. If $$$x_1 \le \frac{n}{2}$$$, then consider $$$x_2 = 2x_1$$$. If $$$y_1$$$ has at least two possible values then at least one is even and we win. (Choose $$$x_1, y, 2x_1, y/2$$$). Otherwise, there's only one possible $$$y_1$$$, and it's easy to check if it works.

    2. If $$$x_1 > \frac{n}{2}$$$, then $$$R \le 2m$$$. Keep a BIT over $$$a[i] = \text{ number of multiples of } i \text{ in } [L, R]$$$, you can keep this updated by doing a total of $$$O(m \log m)$$$ updates, and you can find possible choices for $$$s$$$ by querying the interval $$$[k + 1, n / d]$$$. There's a total of $$$O(n \log n)$$$ choices for $$$d$$$ (counting over all possible values of $$$x_1$$$), so there's also this many queries. This gives a $$$\log^2$$$ solution.

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

    My solution to problem G, AC after 8 minutes of the contest :(

    Let's iterate over all R from left to right, and count how many L such that the subarray [L..R] is good for each fixed R.

    When we are now on a fixed R, we need to know for each number X, what is the range of valid Ls such that the frequency of X in range [L .. R] is 3.

    We can easily do that by storing the indices of number X in a vector V, let's say that the vector size is K, so the valid range of Ls for this X is [V[K-4]+1, v[k-3]], we will use a lazy segment tree to increase / decrease this range each time we see X.

    Let's form an array called can[i], can[i] equals how many distinct numbers in range [i .. R] having frequency equals 3.

    Now our task becomes, for each R, count how many Ls, such that can[L] equals to the number of distinct integers in range [L .. R]. Let's say that distinct[i] = number of distinct integers in range [i..R]. We can easily update distinct[i] while we are iterating over R, when we find a number X we just need to increase distinct[j] by one, such that lastPostition[X] + 1 <= j <= i. We can do that using the same lazy segment tree.

    So we need to count how many (can[i] — distinct[i] == 0). Since (can[i] <= distinct[i]), then (can[i] — distinct[i] <= 0), so we just need to know what is the max number in the lazy segment tree, and if it was 0, we will add the frequency of the max to the answer. So we just need to support querying the max number and its frequency in the segment tree.

    My code: 92841078

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

Can anyone explain the solution of C?

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

    There is two cases.

    1) The first character is 1, then friend have to use the skip(obviously).

    2) There is substring "111". For any other case we can avoid using the skip

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

    I used a dp.

    dp[i][pl][isSecond] is min number of skip points to kill ith boss by player pl with isSecondsth move.

    92828592

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

    I used greedy: For every turn, if its the friend's turn, kill the current boss and see if the next boss is easy, then kill it as well. If its your turn, then kill the current boss and see if the next boss is difficult, then kill it as well.

    My solution

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

      sh_maestro I did the same but got WA on test 2.

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

        funny, same error as mine ;)

        "wrong answer 55th numbers differ — expected: '0', found: '1'"

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

          If you figure out that test case , please tell . I am also getting wrong on same test case.

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

            Most probably 55th Test of 2nd test case is-

            5

            0 0 0 1 1

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

              Thanks!

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

              hey, I also found a similar test case during contest when my similar greedy solution failed on tc-2, but I want to ask that how can we prove the greedy solution wrong by using some mathematical argument or Is finding a counter-example is the only way? as sometime it may be hard to find a counter-example and also takes a lot of time.

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

          In the code by sh_maestro, he is skipping the case when it is your turn and a[i]==0 then he is skipping the boss.

                  if(turn) 
                  {
          	    if(a[i]) 
                      {
          	      ret++;
          	    }
          	    i++;
          	    if(i>=n) break;
          	    if(!a[i])
          	    i++;
                  }
          	else {
          	     if(a[i])    //Why adding this line makes this code AC?
          	     i++;
          	     if(i<n && a[i])
          	     i++;
          	}
          	turn = !turn;
          

          I don't understand why does it lead to correct answer?

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

        I guess the only difference is that I don't kill a boss every turn (I leave the easy bosses for the friend) — since either of us has to kill 1 or 2 bosses every turn. But if there's a hard boss, I always kill him (and the subsequent one — should that be a hard boss as well).

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

      I tried to implement exactly that, but got WA. Can you see where I did wrong? 92817183 thanks

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

        The problem statement is a bit vague and there is room for error — after reading your solution, I re-read it and can see why someone would go with that approach.

        The key difference is that it is not essential for both you and your friend to kill a boss in your turns. So my solution was something like this:

        • The friend starts. He kills the first boss (regardless of hard/easy). Then if the next one is easy, he kills that as well.
        • It's my turn now. If it's a hard boss, I kill it. If there is another one and it's a hard boss, I kill that as well. However, if I had an easy boss, I would just skip my turn, so my friend could kill it in his turn.
        • »
          »
          »
          »
          »
          4 года назад, # ^ |
            Проголосовать: нравится 0 Проголосовать: не нравится

          Sorry, I still do not see the difference.

          The friend uses his second hit if current boss is 0, I use my second hit if the current boss is 1. Where differs your solution from this?

          I did understand that this logic fails for 0 0 0 1 1

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

            "During one session, either you or your friend can kill one or two bosses" — sounds like either my friend or I (or both) have to kill 1 or 2 bosses each round. Though the lines that follow imply that both of us have to alternate and have to kill 1 or 2 bosses in our turn.

            If the statement implies that its mandatory to kill a boss in each turn (as opposed to kill 1-2 bosses in either my friend or my turn), then my solution is wrong (and yours and the other solutions shared here who got WA are correct). The problem writer would need to clarify what the intent was.

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

              I think I just got why your solution works.

              The key realization is when you are skipping, you can actually imagine that as transferring the previous job to me(basically take it away from friend). Then it, doesn't matter whether it was a 1 or 0. It will not affect the answer. The special case is when there is a 0 at the second position. This time you cannot take the previous job, so we imagine that our friend finished the first two bosses. If in the third position, we have a one, "I" will take care and if it is a zero, then we again imagine a redistribution of work in which first job was done by our friend, second one by me and third one by friend again. This way, the solution always yield the optimal answer.

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

                That's an interesting insight! One thing to think about is what happens when this renegotiation ripples to the beginning (i.e. after the negotiation, the first boss needs to be killed by me, however the solution requires the first boss to be always killed by the friend).

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

                  We will not have the ripple back effect because we are always alternating turns and each player can at max handle 2 jobs. When you get a 0 in second place, the friend will take care of it, if we get one more 0, we redistribute as follows:-

                  First(it may be 0 or 1) one is done by friend, second by me and third one by friend again.

                  If you have any counterexamples in mind, please share them?

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

                  Not a counterexample, but how would we explain this for 1 0 0 1 1? I.e. what does the friend take first, then us, etc.

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

                  Okay, so the working will be as follows:-

                  1. First our friend finishes the first two bosses "1 0".

                  2. When we see a "0", we exchange the last boss finished, i.e. "1" one done by friend, the next "0" is done by me and the third "0" is done by friend.

                  3. This way, in the next turn we get to finish the next two hard bosses "1 1" and we are done.

                  I wrote a code for this idea with comments:-link to submission.

                  Did I explain your question?

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

                Amazing realization, thank you for that, it really did help understand the greedy approach:)

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

          As far as I understood the problem, it's mandatory to kill at least one boss in any session (friend's turn or my turn). How can you skip "my" turn?

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

      In the code you have provided in the link, if its my turn and the a[i]==0 then, you have skipped the testcase. I can't understand that part.

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

        I think that's because you would like to (greedily) give the 0 values to your friend , to reduce the count. If you yourself use that value 0 ,then next values may be like 1,1 and friend will need 1 more skip in that case.

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

          What about this line: During one session, either you or your friend can kill one or two bosses (neither you nor your friend can skip the session, so the minimum number of bosses killed during one session is at least one). After your friend session, your session begins....?

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

      I think your solution is correct but explanation is slightly wrong bro, Consider the given case : 1 0 0 1 1

      optimal moves -> Friend, Me, Friend, Me, Me

      but according to your explanation your friend will see that second boss is easy and therefore he will kill it and that will result in not being an optimal choice, isn't it?

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

        The way it works right now would be something like ("F" = Friend, "M" = Me) :

        1 0 0 1 1
        F F F M M
        

        In the above example, on the third boss, I see an easy boss and would skip it (so the friend can kill it)

        Some more examples:

        0 0 0 1 1
        F F F M M
        
        0 0 0 1 1 1 0 1 0
        F F F M M F F M F
        

        In the last example, I can only kill 2 bosses at most, so my friend is forced to use a skip point at boss number 6.

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

    You have to find islands of 1 starting from index 1 and 2 ,then divide it by 3 my soln

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

I couldn't solve a single problem. I hope editorial will help me.

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

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

ok, what I've found out from the round.

  1. I should not have divided doubles

  2. I should have read the tasks very carefully (super carefully, extremely carefully).

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

Looks like there were no testers for this round.

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

Oh my god, 2 questions with minecraft references, who made those questions dude???

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

Can someone please help me out to find flaw in my logic for question D?

-> At the end for each query we are just interested in dividing the array(sorted array) into two subarrays.

-> Answer would be diff (max element and min element of first subarray) + diff(max element and min element of second subarray).

-> Also dividing subarray would be optimal when we divide around mid value(max element + mid element)/2

Attached my solution(not sure why its failing on test case 3)92839897

It would be great if someone can please provide a counter example so that I can figure out why my algo is incorrect.

Thanks In Advance.

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

    1
    4
    1 1 100 1000000

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

      Sorry man, I am not able to understand your test case. What I understood from question, all the pi will be different and in above test case there are two ones.

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

    Also dividing subarray would be optimal when we divide around mid value(max element + mid element)/2

    Try 1,3,4,5,6; optimal division point is at 2

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

      What is the expected correct answer? I can see my solution gives answer as 3. Is that incorrect?

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

        The answer is end value — starting value — (maximum distance between any two consecutive elements after sorting ofcourse)

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

          I see, thanks.

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

            I made the same mistake :) That is optimal for the 2 sides separately but not combined. Eg: 1, 20, 40, 60, 100. Optimal for 60 to go left.

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

              It was kind of easy to think, but my bad I was just trying to correct my above solution by thinking counter example. I would have thought for a different approach.

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

Can anyone hint me on E?

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

    $$$O(n*m)$$$ is trivial if you know about linearity of expectation. To optimize it observe that for a fixed shield all $$$d_i$$$ smaller than $$$b_j$$$ have same contribution(number of ways such that we can $$$d_i$$$ damage to $$$j'th$$$ shield) and all $$$d_i$$$ greater than or equal to $$$b_j$$$ have same contribution. Do some counting and prefix sum and binary search and that's it.

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

      I can form the expression. Evaluating it takes O(n) for each sample can't see of a way to optimise it further. Would be great if you could check this out —

      If (count of no of d(j) >= b(i)) <= a[i](Let this be a for the moment) then the answer is zero. Else from linearity of expectation the total damage can be expressed as D = D[1] + D[2].... + D[n]. Clearly E[D[k]] = 0 for k <= a. For any other k > a it remains to evaluate E[D[k]], which can be obtained by using the definition of Expectation and the associated probabilities can be obtained using combinatorical arguments.(Does there exist a smarter way of doing this, without explicit counting?)

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

can greedy approach work for C ?

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

    No. Dp solution works

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

      I am not able to see any case where my greedy solution will fail. It is wrong on some 55th case in tc 2.

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

    Yes, just prevent consecutive 3 ones. Check separately for first element.

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

      can you elaborate a bit on how you come up with the greedy solution and also some arguments why your greedy solution work.

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

        after some starting series on one's both players can play optimally to chose their places accordingly that if k consecutive 1s are there then at max only k/3 ones will be handled by friend player due to the fact that since they have the choice to play optimally they can always chose who is going to start this segment of 1s either first player or his friend player. now lets say we start with player who have no bias for 0 ,1 then he will try covering as much as possible he covered 2 ones from k. after this the friend player covers another one. then remaining sequence contains k-3 ones. this happens continuously until k is emptied!. Just handle starting and ending points separately for each segment as they decide optimal choice for next move!.

        Prove that after firs position they can decide any position that they want to pick. lets say in order to come at position i x1 moves included only 1 movement to right and again lets say x2 moves included 2 step movements. then as __gcd(1,2)=1. thus x1*1+x2*2 can take any possible value thus it is always available with us to chose positions in the most optimal manner and minimise the skip points hence we can solve it greedily!

        Have a look at my simple solution!

        92891977

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

    Yes We can!

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

Can someone explain the solution of E?

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

    By linearity of expectation the answer for a fixed shield is the sum of probabilities that monster deals damage times the monster's damage.

    1) Monster deals damage if more than $$$a_i$$$ monsters with damage bigger than or equal to $$$b_i$$$ come before it.

    2) Fix set of all monsters with $$$d_j \ge b_i$$$ and add the current monster to it if it's not already present. Let the size of this set be $$$N$$$.

    3) Then the probability we search is just the probability that in the fixed -- during the step $$$2$$$ -- set the current monster comes at least ($$$a_i + 1$$$)-th. We don't care about other monsters, that is, we look only at relative positions of a fixed set

    4) Probability that monster comes at any position is 1/N, so the probability $$$P(pos \gt a_i) = \frac{N - a_{i}}{N}$$$.

    5) $$$O(nm)$$$ solution is as follows: calculate $$$d_j P(pos \gt a_i)$$$ for each monster $$$j$$$ and each shield $$$i$$$.

    6) it can be optimized using binary search and prefix sums.

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

Hints for G, please?

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

What's the logic behind problem D ?

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

Can someone explain the statement of Problem B, What does it mean that find the minimum k where k is the maximum j where p[j]<0 ??

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

    last value of index j in the array such that p[j]<0, which is denoted as k , should me minimum. Like: supoose we have n=4 a[]={2,-3,4,-1} l[]={0,0,1,0} so the corresponding sum prefix array will be sum[]={2,-1,3,2}, here max j such that p[j]<0 is j=1 , so k=1. new array such that the condtions are satisfied will be a[]={2,-1,4,-3} Here , sum[]={2,1,5,2} , here max j such that p[j]<0 , is that it does not exist .Accoridng to question , in such cases k=0.So, here answer is k=0 , not k=1 and requires array after rearrangment is a[]={2,-1,4,-3}. I hope this helps and clarifes ur doubt.

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

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

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

Quick observations for D:

The problem is equivalent to solving the following problem

For a set of points A, find two segments whose union is A and whose combined length is minimal

with updates to A. Unfortunately this is somewhat hard since the optimal assignment of points to segments can change a lot after every update. Fortunately the following problem is much simpler

For a set of points A, find the largest gap between two adjacent elements of A

since updates to A changes the set of gaps by a small amount. The answer to the original problem is max(A) - min(A) - (largest gap between two adjacent elements of A)

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

    I am not getting the intuition. Can you elaborate why it works?

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

      I guess he missed that we need to sort the coordiantes first!

      First sort the coordinates. If we could keep only 1 coordinate(containing all the piles) in the end, the answer will be p[n]-p[1]. But here we can keep 2. So basically we need to select a prefix array p[1..l] ,which denotes our first group and p[l+1..n] the second group, such that p[l]-p[1] + p[n]-p[l+1] is least. Here p[n] & p[1] are always same, the remaining p[l]-p[l+1] is difference between adjacent elements.

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

editorial by tourist.

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

Дно пробито, можно закрывать эдьюкейшнлы

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

Can someone please help me figure out why this solution for D is resulting in a TLE. Thanks a lot in advance.

Code

Found it: Thanks a lot for the help.

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

Kindly someone explain me the greedy solution to C

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

The quality and accuracy of problems should be taken more seriously than how funny the legends are.

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

Moral of this contest- always think a dp, before you do a greedy, and see if it works with the constraints. Greed is not good.

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

    It is the opposite. Always consider the simpler solution first.

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

      Would you suggest to go for a greedy solution first although it's not sure to work? Problem C for example. Would you do greedy or dp?
      Dp is sure to give the correct answer whereas greedy might fail.

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

        1) Well, of course you shouldn't code greedy if it doesn't work, but it makes sense to consider it first

        2) I solved C with greedy...

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

          Actually, many have a "confusion" about dp and greedy problems. Some find it difficult to distinguish between dp and greedy problems or judge the way solution would work.

          Is there something that could help us predict that a problem is to be solved using dp or geedy? Although many times, we can FEEL it, but we can't express it in words why it's a dp or greedy.

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

      I think one should go for dp. DP solution is simpler than the greedy one because its difficult to prove the greed.

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

    Don't trust this guy

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

I have solved C using DP, can someone provide me the logic for the greedy solution.

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

    Let the friend kill the first boss(and second if it's easy), number of skips will be updated accordingly. Now it's your turn to kill. For every island of 1's (groups of consecutive 1's) the number of skips the friend will need are SizeOfIsland/3 as for every 3 consecutive 1's the friend has to skip at least 1 of them. Let's take an example, input = 10111011111, your friend kills bosses at index (0,1,4,5,8).Two of these were easy so total number of skips = 3 (He will never kill two hard bosses in one turn, it's always better to kill one and end his turn). Take other cases and see that it works. Have a look at my submission. 92823703

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

Why Unrated!!!We can just extend the length of the contest

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

Please give a test-case where this greedy approach fails for Problem-C. Sol. Link — https://mirror.codeforces.com/contest/1418/submission/92829566

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

Third problem was really a must do for someone struggling with dp.

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

Sol. Link for Problem-C — https://mirror.codeforces.com/contest/1418/submission/92829566 In this Solution's test details , it is written that it fails on 55th I/P but 55th I/P is not showing. Please provide a test-case where this greedy solution fails.

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

Third problem was really a must do for someone struggling with dp.

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

Nice set of questions . No worries, we are eagerly waiting for the upcoming educational rounds . Cheers to your hard work ...

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

[Deleted]

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

[deleted]

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

It is very sad that after great effort these problems were invented and prepared by inventors, the result is:

Spoiler

I hope in the future there will be testers for Educational Codeforces Round!

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

As a compensation can you give me the contact number of the trader which gives me 10^9 stick in exchange of 1 stick.

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

A contest announcement with most downvote ?

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

Hi awoo , is there any possibility that you post the editorial? I actually liked the problems and I'd love to learn more from the problems.

Thanks

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

Every contest should be rated. As situation is same to every contestant.

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

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

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

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

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

Anyway, your problems are very good, cheers!

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

Why too much down vote ? Actually, This is not good at all. Take the issue as simple. you should be thankful for testers and setters.

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

Why too much down vote ? Take the issue as simple. You should be thankful for the testers and setters.

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

It was always interesting for me, why people downvote announcements of unrated contests? People gave you some tasks, contest was unrated but why they should have negative contribution because you are angry?

Everyone wants to have contest often, but you should accept the risk of unrated contest and react normally, not just pressing downvote button.

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

    imagine getting free interesting practice problems and get mad about it because they don't give you some internet point.

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

      It's not like there is shortage of practice problems on the internet and on codeforces in particular.

      People who registered for the contest obviously wanted, you know, a contest. And this part was ruined. Moreover it was not ruined because of something unpredictable like a sudden outage of servers, but because of terrible organization. If this contest doesn't deserve downvotes, then I don't know which one does.

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

        imagine thinking a contest is a ruin because it doesn't give you some internet point

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

        But surely the one who made the questions doesn't deserve downvotes does he

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

btw, whose alt account is top 1?

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

Mistakes happen.No need to feel sorry, the problems were really interesting. :)

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

Sorry, I'm new. When the round is unrated it means that the contest doesn't count in your personal rating?

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

Solution to Problem C Mortal Combat Tower in youtube video.

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

Trash problem is really trash.

Can anyone explain how 5 is coming as the output of this 1 2 6 8 10?

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

    they will choose the points 2 and 6

    10, 8 and 6 will go to 6 and this will cost 4 moves, 1 and 2 will go to 2 and this will cost 1 move

    the total moves = 5

    btw this's one of the best problems I ever seen and it's very helpful

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

      We have to find min. number of moves.

      So i'll move 6 to 8, cost=1.(moving x to x+1 will result in 1 move) moving 10 to 8, cost=1.(moving x to x-1) moving 1 to 2, cost=1.(moving x to x+1)

      overall cost should be 3. WHY 5?

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

        Please tell me that you're joking, did you even know that 1+1 = 2 ?

        Moving 6 to 8 needs 2 moves, 10 to 8 also 2 moves, finally 1 to 2 needs 1 move.

        The total moves = 5 !!!