By PikMike, history, 2 months ago, translation, In English,

Hello Codeforces!

On Oct/08/2019 17:35 (Moscow time) Educational Codeforces Round 74 (Rated for Div. 2) will start.

Series of Educational Rounds continue being held as Harbour.Space University initiative! You can read the details about the cooperation between Harbour.Space University and Codeforces in the blog post.

This round will be rated for the participants with rating lower than 2100. It will be held on extended ICPC rules. The penalty for each incorrect submission until the submission with a full solution is 10 minutes. After the end of the contest you will have 12 hours to hack any solution you want. You will have access to copy any solution and test it locally.

You will be given 7 problems and 2 hours to solve them.

The problems were invented and prepared by Roman Roms Glazov, Adilbek adedalic Dalabaev, Vladimir Vovuh Petrov, Ivan BledDest Androsov, Maksim Ne0n25 Mescheryakov and me. Also huge thanks to Mike MikeMirzayanov Mirzayanov for great systems Polygon and Codeforces.

Good luck to all the participants!

Our friends at Harbour.Space also have a message for you:

Hello Codeforces,

First of all, thank you for the great feedback on our survey from the last Educational Round. Over 300 people participated, and we hope to start implementing some of your suggestions really soon.

We also wanted to let you know that we have extended the deadline for our fully-funded scholarships for Masters programs in Bangkok.

Remember, they cover the entire tuition fee as well as the cost of living expenses, so If you or someone you know are interested in technology, entrepreneurship, or design, and believe you have what it takes, we want to hear from you!

APPLY HERE→

Last, but not least, we would like to recommend an article published in our blog last week about the “Top 5 Soft Skills Every Developer Has to Have”. What do you think, do you agree with this list?

Congratulations to the winners:

Rank Competitor Problems Solved Penalty
1 HIR180 7 296
2 9623 7 317
3 stasio6 7 350
4 sigma425 7 400
5 jiangly 7 405

Congratulations to the best hackers:

Rank Competitor Hack Count
1 kimbj0709 120:-19
2 Astaa 107:-111
3 baluteshih 48:-9
4 galen_colin 40:-3
5 Rian_5900 34:-13
571 successful hacks and 641 unsuccessful hacks were made in total!

And finally people who were the first to solve each problem:

Problem Competitor Penalty
A algo.code 0:00
B L4U 0:04
C OmegaLUL229 0:17
D MarcosK 0:08
E GyojunYoun 0:09
F ksun48 0:29
G NotNight 0:51

UPD: Editorial is out

 
 
 
 
  • Vote: I like it
  • +60
  • Vote: I do not like it

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

hope that problems be as good as the problems of the last contest was .

»
2 months ago, # |
  Vote: I like it -67 Vote: I do not like it

Is it rated?

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

PikMike and Vovuh together to prepare a contest that will be awesome ^_^.

»
2 months ago, # |
  Vote: I like it +106 Vote: I do not like it

Wish no ddos, no long queue, no aliens attack, no world crash.

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Codeforces are inherently good, and every contest is carefully prepared by the host. But there're always someone to attack this website over and over again, destroying fair competition and causing trouble for the contestants. Hope them don't do it again!

  • »
    »
    2 months ago, # ^ |
      Vote: I like it -6 Vote: I do not like it

    If they do this, they will waste the chance of the competitor’s (possible) increase rating.

»
2 months ago, # |
  Vote: I like it +4 Vote: I do not like it

It will be an interesting contest.

»
2 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

How to calculate penalty?

»
2 months ago, # |
  Vote: I like it +5 Vote: I do not like it

Hope NO DDOS.

»
2 months ago, # |
  Vote: I like it -48 Vote: I do not like it

Can you, please, click on the like?

»
2 months ago, # |
  Vote: I like it +23 Vote: I do not like it

Site broke for 10 minutes or was it just me?

  • »
    »
    2 months ago, # ^ |
    Rev. 2   Vote: I like it +2 Vote: I do not like it

    +1, was 100% it was my local network at first but reddit showed no issues AT ALL loading in the same time.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Gave my Bad gateway in the first minute of the contest and still does

»
2 months ago, # |
  Vote: I like it +2 Vote: I do not like it

I am experiencing issues while submission. Is it for everyone or just me?

»
2 months ago, # |
  Vote: I like it +8 Vote: I do not like it

CF rarely responding. 502 Bad gateway VK. Same with m1 and m2 :(

»
2 months ago, # |
  Vote: I like it +28 Vote: I do not like it

Queueforces.

»
2 months ago, # |
  Vote: I like it +11 Vote: I do not like it

Long queue causes distraction this is not ok

»
2 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Please make this unrated now otherwise there is gonna be a huge rating drop. I have currently submitted just the A problem and can't submit B problem

»
2 months ago, # |
  Vote: I like it +10 Vote: I do not like it

CF giving issues. Bad gateway.

»
2 months ago, # |
  Vote: I like it -6 Vote: I do not like it

Unexpected error forces

»
2 months ago, # |
  Vote: I like it +10 Vote: I do not like it

Even m2.codeforces.com is not working :(

»
2 months ago, # |
  Vote: I like it +42 Vote: I do not like it

contest should be unrated!

»
2 months ago, # |
  Vote: I like it +18 Vote: I do not like it

gg go next

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

:'(

»
2 months ago, # |
  Vote: I like it +10 Vote: I do not like it

Round should be unrated.

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

long queue of the judging?

semi rated?

»
2 months ago, # |
  Vote: I like it +18 Vote: I do not like it

100 pages of queue, nice

»
2 months ago, # |
  Vote: I like it +7 Vote: I do not like it

Is it rated?

»
2 months ago, # |
  Vote: I like it +24 Vote: I do not like it

Please make this unrated ..... 100 pages of queues.

»
2 months ago, # |
Rev. 2   Vote: I like it +11 Vote: I do not like it

This site began to have serious issues... 25 minutes waiting for my submission to be judged? FFS!

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

DDOS again?

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Who make DDOS again?!

»
2 months ago, # |
  Vote: I like it +54 Vote: I do not like it

Round should be unrated

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

More than 100 pages of queue.This round should be unrated.

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Seriously This is happening again!!! Codeforces do something fast or you are going to lose a lot of contestant.

»
2 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Again DDOS, again unrated

»
2 months ago, # |
  Vote: I like it +45 Vote: I do not like it

AnouncementForces lol....Leave DDOS , too much clarification for problems in my opinion.

»
2 months ago, # |
Rev. 2   Vote: I like it +148 Vote: I do not like it

I support problemsetters in nearly all situations, but today it's a shame really. The amount of messages with clarifications is astounding. Were the problems developed 1 day before the contest?

»
2 months ago, # |
  Vote: I like it +41 Vote: I do not like it

Seems like an overall disaster.Many problem statements are faulty and contest is taken without addressing the DDOS issue of the last contest.Disappointed in codeforces.

»
2 months ago, # |
  Vote: I like it +11 Vote: I do not like it

Please explain D more properly how is ans 6 for 1 st test case

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Given string AABBB has these substrings:

    substrings

    Well, substrings with length 1 are bad from the definition. Let's remove them.

    new list of substrings

    AA is palindromic, so it's good.

    AAB is bad, because you can't get palindrome with B.

    AABB, AABBB are good, because AA is palindrome and BB is palindrome.

    AB, ABB, ABBB are bad.

    BB, BBB, BB are good. Now we have only 6 substrings:

    good substrings

    And answer is 6.

»
2 months ago, # |
  Vote: I like it +19 Vote: I do not like it

problem writers were extra bad today

»
2 months ago, # |
  Vote: I like it +57 Vote: I do not like it

BREAKING NEWS

The round is rated

»
2 months ago, # |
  Vote: I like it +61 Vote: I do not like it

DDOS attack + ambiguous questions + long queue submission = Unrated contest

»
2 months ago, # |
  Vote: I like it +13 Vote: I do not like it

The contest should be unrated.Increase in contest length does no good

»
2 months ago, # |
  Vote: I like it +19 Vote: I do not like it

Can the conditions of the tasks be even longer and even more unclear?

»
2 months ago, # |
  Vote: I like it +3 Vote: I do not like it

The contest should be unrated.Increase in contest length does no good.

»
2 months ago, # |
  Vote: I like it +28 Vote: I do not like it

It is will be rated? Dudes, are you seriously?!

»
2 months ago, # |
  Vote: I like it +111 Vote: I do not like it

Bad Day :(

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +6 Vote: I do not like it

    I think the problem statement for C was clear. There was a typo in B but it was an obvious one, especially when you check the test cases.

    • »
      »
      »
      2 months ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      If you only can understand by test case, it means that there is wrong in statement. Statment should be clear which means that we have to understand without testcase.

»
2 months ago, # |
  Vote: I like it +135 Vote: I do not like it

Fucking problem B wastes me more than half hours. Statement was WRONG but you told us after contest has begun 23min. Making such a fucking mistake and then you say rated.Are you kidding me?

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Told them this 8 minutes into the round. They announced it 15 minutes later...

»
2 months ago, # |
  Vote: I like it +32 Vote: I do not like it

please unrated ,just after chines national day and i need VPN?

»
2 months ago, # |
  Vote: I like it +38 Vote: I do not like it

Should be unrated because of: 1- Problem had a wrong statement (I think until 20 minutes after the beginning) 2- Long queue affected me and lots of other contestants 3- Too much clarification 4- DDOS attack

»
2 months ago, # |
  Vote: I like it +19 Vote: I do not like it

I think this contest must be unrated i have a little mistake in b I wait ~20 minutes for queue and then i see that my solution get wa then i saw my mistake but 20 minutes = so many people goes to in front of me.

»
2 months ago, # |
  Vote: I like it +10 Vote: I do not like it

The site was woking perfectly before the start of contest.But from around 10 minutes before the contest, I couldn't enter codeforces entire time using my wifi. But when i switched back to my mobile network everything is working. Is anyone else facing this problem?

»
2 months ago, # |
  Vote: I like it +17 Vote: I do not like it

10 Announcement. What is this?

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    if the problems statements were clear then there was no announcement(except DDOS attack announcement)

»
2 months ago, # |
  Vote: I like it +5 Vote: I do not like it

something must go wrong in CF contest. it's just must.

»
2 months ago, # |
  Vote: I like it +6 Vote: I do not like it

Does it test programing or English Reading Comprehension????

»
2 months ago, # |
  Vote: I like it +29 Vote: I do not like it

Why is this contest Rated? Please UNRATED!!

»
2 months ago, # |
  Vote: I like it +30 Vote: I do not like it

1238B - Убей их всех — the name literally describes my feelings when I wasn't able to send solutions for 20 mins...

And before DDOS CF said "we have new IP-adresses, won't work in your country without VPN". What a lovely day

»
2 months ago, # |
  Vote: I like it +29 Vote: I do not like it

Me logging into codeforces and getting 10 notifications: Is this what it feels to be popular?

»
2 months ago, # |
Rev. 2   Vote: I like it +34 Vote: I do not like it

Anyone else thought that the whole English alphabet is possible in D then when they realized that it's called AB-string solved it in 10 min?

Edit: BTW, is it even possible to solve it if there are 26 letters? I think I have O(n^2) solution only.

»
2 months ago, # |
  Vote: I like it +13 Vote: I do not like it

I just don't understand the reason as to why people are asking for the contest to be unrated. Yeah, ok, maybe the site was broken for some time, and they did extend the time limit to compensate for that.

The problems could have been made clearer, but none of them were so wrong that they were unsolvable, unless you couldn't apply common sense (except F, where the sample case was wrong).

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Totally agree. I kept refreshing when site went down and after 10 minutes it came back up. Also my submission judged in like 10 minutes too. After that it was all good. About the statements, yeah they were not the cleanest but I understood problems correctly. Even though I didn't perform my best, it should be rated.

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it +16 Vote: I do not like it

      When the site went down, I had B ready to submit but I didn't open the statement of C, So I had nothing to do while the site was down, whereas some other contestants had something to work on, so this is a problem!

      • »
        »
        »
        »
        2 months ago, # ^ |
          Vote: I like it -28 Vote: I do not like it

        The same happens to me, but still i think this round should be rated, when site wake up, there is enough time for me to solve 'C' or 'D'.

      • »
        »
        »
        »
        2 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        shut up noob !

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +6 Vote: I do not like it

    Yes, but maybe some people just left after seeing that there were some problems with the site.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +21 Vote: I do not like it

    You just named at least 3 reasons for it to be unrated...

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    Because when the system broken down.Some people think the situation will as same as the day before yesterday,so they give up the contest.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    There are close to 1000 peoples who manage to solve 4 or more problem in this round, it doesn't looks that DDOS attack, queue and ambiguous statement too much affect the performance of large no. of participants.
    Also making '2' back to back round unrated, look's too bad for codeforces.

»
2 months ago, # |
  Vote: I like it -19 Vote: I do not like it

This is the most fucking unlucky contest ever for me. I submitted with wrong compiler and it gave me some random number as answer and then I realized I was clearing my whole dp array in every query in Problem F(How stupid I am). When I got TLE, I tried to fix it last second but couldn't ffs.

»
2 months ago, # |
  Vote: I like it +5 Vote: I do not like it

How to solve D? I know there is some optimization because given characters are a and b only, but can't figure our how to use this hint?

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +6 Vote: I do not like it

    Try to count non good strings. Note that a string is not good only when either its length is one else both characters are present in it and one character just appears once either at the beginning or at the end of the string.

  • »
    »
    2 months ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it

    we can see that string is not good only if there is only one symbol A or only one symbol B in the front or in the end (like ABBBB, BBBBA, AAAB, BAAA). so we can count not good substrings and answer is n * (n + 1) // 2 minus (num of not good substr)

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    the idea is to count bad substrings instead of good ones. and answer is (n+1)*n/2 — bad; good observation about bad strings a string is bad "not good" if it's first or last character unique . things like A...AB or BA...A. this help you count bad strings as follows for each position find all bad strings ending there as difference between current position and previous position of same character. same way you count all bad strings starting at each position. now all bad strings are counted but some counted twice ! which ones all strings "AB" or "BA" as will be counted twice remove them once. other group is strings of size 1 be sure to remove them only once!

»
2 months ago, # |
  Vote: I like it -19 Vote: I do not like it

Poor English Statement :'(

»
2 months ago, # |
  Vote: I like it +25 Vote: I do not like it

Problem statements were a bit vague ,followed by the 1 hr. DDOS attack recovery .Still they didn't give up on the contest and made the contest attemptable .......I appreciate that part

»
2 months ago, # |
  Vote: I like it +58 Vote: I do not like it

What I learned today? Opening tabs with all problem statements while CF is still alive should become my new contest routine. Otherwise my F5 key will wear out pretty soon.

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Didn't had problems understanding the problem statements, and uploading worked fine after some tries. Not to bad.

But was not able to find proper implementation for problems C, D and E :/

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

when will we be able to submit?

»
2 months ago, # |
  Vote: I like it +30 Vote: I do not like it

The contest should be unrated because probably some people left immediately after they saw that there was a problem with the site. In fact, I also thought about leaving, but in the end I decided to stay idk why and then after the site started working properly I just read the statements of the problems and again thought about leaving but then the announcement about the contest being rated appeared, so I decided to stay though. Anyway, I think that rating is not that much important, but again it should show skills of people, so imo it will be a bit unfair if the contest is rated.

»
2 months ago, # |
  Vote: I like it +29 Vote: I do not like it

I read Problem C statement for 1hour 30min xD.

»
2 months ago, # |
  Vote: I like it +142 Vote: I do not like it

About the statements.

First of all, I want to apologize for my bug in the statement of B. We noticed it really fast and would have fixed it if the system was working properly, but it is not an excuse for me.

I don't get why people are so angry about the statement of C. Most participants who understood it incorrectly thought that it was possible to jump from one platform to another, and there were a lot of questions about that -- but I don't understand why the participants thought so. There is not a single word "jump" in the whole statement, but people still thought it was possible to jump down; furthermore, the phrase that pulling a lever is the only way to move between platforms was in the statement all along since the beginning of the contest.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +21 Vote: I do not like it

    Error on statement B was obvious imo. And sample test answer on F corrected fast. So its all good man.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +17 Vote: I do not like it

    I just felt like statements of B and C were closer to normal rounds, not educational. But also, when I look at the statements I can't really think of any simpler version.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +9 Vote: I do not like it

    I believe that none of the people who understood incorrectly statement C though of the word jump. I think that most of us were confused by the part "(...) then he can pull a special lever (...)", which gives the idea that pulling the lever is not mandatory. Let's remember that most of people try to read fast the statement and usually ignore everything after they "understood" it. Thus, most of us ignored the part that came after it "(...) Note that this is the only way to move from one platform to another. (...)".

    However, the fast response to the questions was nice.

  • »
    »
    2 months ago, # ^ |
    Rev. 2   Vote: I like it -7 Vote: I do not like it

    1

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    After reading the first two paragraphs they might have gotten the idea that one can simply pass through platforms, since this is a common feature in platformer games. Then they skimmed the leaver part figuring it was just a gimmick to explain the "going down" part. Maybe at that point it was hard to notice that something could be wrong, because including the "passing through" feature would make for a reasonable task.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    the confusion was may be for this line "then he can pull a special lever" , which should have been "then he has to pull a special lever" . Though it was eventually clear to me, but there's should be no surprise if someone gets confused for this.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    For me this part is confusing: “ In other words, the platform you are currently standing on will hide in the cliff and the platform one unit below will change it state: it will hide if it was moved out or move out if it was hidden. In the second case, you will safely land on it. Note that this is the only way to move from one platform to another.” I understand from this that I can only move from Platform X to Platform X-1!? You should use “pulling a lever” instead of confusing word “this” in phrase “this is the only way...”

»
2 months ago, # |
  Vote: I like it -9 Vote: I do not like it

Can someone explain problem C, I think didn't understand the question ?

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    you're not alone !

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    As per my understanding you need to reach height 0 from h and you are allowed to perform following operations : a) pull the lever : that changes state of current height's platform and the one below. As the current height's platform's state changes, i.e., it goes hidden you fall, you fall till the height whose platform is out but if the height differnce you fell is more than 2 you die. b) use crystal : this helps change state of a paricular platform at a height you choose.

    Find the minimum no. of 2nd type operations to reach height 0 from height h without dying.

  • »
    »
    2 months ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it

    There are platforms numbered from $$$1$$$ to $$$h$$$, the number of a platform represents its height from the ground

    Each platform can have 2 states, it's either hidden (you can't land on it) or visible (you can land on it if the distance between the current platform you're on and the one you want to reach is at most $$$2$$$), at each platform there is a lever, if you move the lever at platform $$$X$$$, the platform at height $$$X$$$ and height $$$X-1$$$ change their state (if a platform is hidden it becomes visible and vise-versa).

    Assume you're currently at platform $$$X$$$, there are only 2 scenarios in which you can move from $$$X$$$:

    1- $$$X$$$ is visible, $$$X-1$$$ is hidden. You move the lever which causes $$$X$$$ to disappear and $$$X-1$$$ to appear, you move from $$$X$$$ to $$$X-1$$$.

    2- $$$X$$$, $$$X-1$$$, and $$$X-2$$$ are all visible, if you move the lever at $$$X$$$ then both $$$X$$$ and $$$X-1$$$ will disappear and you move to $$$X-2$$$.

    You also have the option to change the state of any platform using a crystal.

    You are initially at platform $$$h$$$ and you're given a sorted sequence of the platforms which are currently visible, you're asked to reach the ground at height $$$0$$$ (the ground is not a platform) using the minimum number of crystals.

»
2 months ago, # |
Rev. 2   Vote: I like it -14 Vote: I do not like it

Unrated round please, because due to long queue and DDOS attack many people got late submission penalty and were unable to think about the problems in their natural style.

»
2 months ago, # |
  Vote: I like it +20 Vote: I do not like it

I don't understand why so many people want this round to be unrated, when everybody could see the statments and during not working judge (for 15 minutes) everybody could't submit, so it's not something special.

»
2 months ago, # |
  Vote: I like it +26 Vote: I do not like it

I got Codeforces moved to new IP addresses. Probably, it can be blocked in some countries (Ukraine?). You can use VPN or other similar methods to deal with it. message when contest started. (Im in Japan) CF Team grasped this situation?

»
2 months ago, # |
  Vote: I like it +5 Vote: I do not like it

»
2 months ago, # |
  Vote: I like it +4 Vote: I do not like it

I don't understand problem c :(

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve E?

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +14 Vote: I do not like it

    Seems like DP+bitmask. But I couldn't come up with dp states. If I let mask be the set of elements we have put in our permutation to far, to put another element would require knowing the position of each element in mask which cannot be known from mask alone. I couldn't go futher.

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it +34 Vote: I do not like it

      Yes dp with submasks, and when you consider new element calculate its contribution to the answer. Just add position of this element multiplied by the amount of used symbols to which the new one is adjacent and substract position multiplied by the number of unused adjacent elements.

      • »
        »
        »
        »
        2 months ago, # ^ |
          Vote: I like it +2 Vote: I do not like it

        Amazing solution. Had to read your comment for 10 times to finally understand how this was working.

        • »
          »
          »
          »
          »
          2 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Can someone explain how this logic works?

          • »
            »
            »
            »
            »
            »
            2 months ago, # ^ |
            Rev. 2   Vote: I like it +13 Vote: I do not like it

            You assign positions to characters in the order $$$ 1 \ldots m $$$. So for a character $$$i$$$, the characters adjacent to it which are used will have positions smaller than $$$pos_i$$$, and those unused will have positions greater than $$$pos_i$$$, so when you simplify the absolute values, contribution of $$$pos_i$$$ is positive in first case and negative in the second.

            • »
              »
              »
              »
              »
              »
              »
              2 months ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              can you explain it more briefly with some small example, that would be very helpful

              • »
                »
                »
                »
                »
                »
                »
                »
                2 months ago, # ^ |
                Rev. 2   Vote: I like it +34 Vote: I do not like it

                Suppose $$$m = 110001$$$, this means that we have put the first, second and sixth characters on the keyboard.

                $$$f(m = 110001)$$$ is the minimum cost that it will take to put the first, second and sixth character on the keyboard.

                Now, suppose we want to add the fifth character. The mask becomes $$$m = 110011$$$.

                When we are calculating $$$f(m = 110011)$$$ having placed the fifth character last, the fifth character will be at the position 4.

                • Whenever $$$5$$$ is paired with $$$1, 2, 6$$$, we will add +4 to the answer (Because $$$5$$$ is at position $$$4$$$ and comes after $$$1, 2, 6$$$ in the keyboard)
                • Whenever $$$5$$$ is paired with $$$3, 4$$$, we will add $$$-4$$$ to the answer. (Because $$$5$$$ is placed at $$$4$$$ which is before $$$3, 4$$$ in the keyboard).

                The beautiful idea of this solution is that we do not need to know the relative order of the keyboard ! All we need to know is which characters are already processed. If we are adding a new character, we know it's position in the keyboard. And regardless of the position of the other characters, we can calculate it's contribution to the sum easily !

                Thanks a lot straw_boy,AleksanderBalobanov and ankusht

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  2 months ago, # ^ |
                  Rev. 2   Vote: I like it +3 Vote: I do not like it

                  Why does this idea work:

                  I mean why do we add $$$+4$$$ to all the previously placed numbers ($$$1,2,6$$$) and not have to add different numbers $$$+3$$$, $$$+2$$$, $$$+1$$$ respectively?

                  The reason being when $$$1$$$ was placed at some earlier point in time, it had to add $$$-1$$$ and $$$2$$$ had to add $$$-2$$$ and $$$6$$$ had to add $$$-3$$$ and when you adjust for those earlier additions you now instead have to $$$+4$$$ to all (instead of $$$+3$$$, $$$+2$$$, $$$+1$$$ resprectively)

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  2 months ago, # ^ |
                  Rev. 2   Vote: I like it +3 Vote: I do not like it

                  In the example I provided $$$m = 110001$$$ was already placed.

                  When I am placing the new character $$$5$$$ at position $$$4$$$, then the cost will be increased by $$$(4 - 3) f(5, k(3)) + (4 - 2)f(5, k(2)) + (4 - 1) f(5, k(1))$$$

                  Where $$$f(4, k(i))$$$ denotes the frequency of the pair $$$(5, k(i))$$$ in the password where $$$k(i)$$$ is the $$$i$$$ th key in the keyboard

                  After this, there will be two more characters, who's cost will be $$$(5 - 4)f(5, f(k(5))) + (6 - 4)f(5, f(k(6)))$$$

                  So, when we are inserting one character, we just add it's contribution to the sum independently of the positions of the other characters.

                  So, when we added $$$1, 2$$$ at earlier points in time, we already accounted for their $$$-$$$ contributions and when we will add $$$3$$$ at some later point in time, we have already accounted for $$$4$$$'s positive contribution

      • »
        »
        »
        »
        2 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Thanks for the solution! ^^

        I had to really squeeze it in order to get it to pass, and I believe 800 ms is not the intended time.

        Can you propose any optimizations? or some other way to code it?

        I know coding an iterative dp will be faster, but I still think this is too much.

        • »
          »
          »
          »
          »
          2 months ago, # ^ |
            Vote: I like it +3 Vote: I do not like it

          We can achieve $$$O(2^N * N)$$$ by precalculating function $$$g(mask, i)$$$ — the number of symbols in mask adjacent with symbol i. To calculate each state of it in $$$O(1)$$$ just consider any bit $$$j$$$ in mask suppose the lowest and then do the following $$$g(mask, i) = g(mask$$$ $$$xor$$$ $$$2^j, i) + c(i, j)$$$ where $$$c(i,j)$$$ is the number of times symbols $$$i$$$ and $$$j$$$ are adjacent.

          • »
            »
            »
            »
            »
            »
            2 months ago, # ^ |
            Rev. 2   Vote: I like it 0 Vote: I do not like it

            Thankss!

            I spent a lot of time trying to preprocess something that can get me $$$O(2^N * N)$$$ but I always loop for that $$$j$$$ you mentionned.

            Very nice and simple trick to just choose one single bit and use the previous states!

        • »
          »
          »
          »
          »
          2 months ago, # ^ |
          Rev. 2   Vote: I like it 0 Vote: I do not like it

          I didn't squeeze my solution and it passed though without any optimisations!

          Maybe the check on line 25 if (!((msk >> i) & 1)) is all what is needed, not sure :)

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

the contest should be rated i know many were troubled by long queue even me but it was just for 20-30 minutes and the contest was extended by that much and the problem setters works really hard to make these questions.

»
2 months ago, # |
  Vote: I like it +2 Vote: I do not like it

How to solve C?

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

This contest should be unrated!!!!!! Because when the system broken down.Some people think the situation will as same as the day before yesterday,so they give up the contest.

»
2 months ago, # |
  Vote: I like it +28 Vote: I do not like it

Normal people expect to do easy works. Look, there are over 2000 people solved C, so stop moaning about statement please!

»
2 months ago, # |
Rev. 2   Vote: I like it -12 Vote: I do not like it

Problem C: Why 1 correct answer for this test ?

1
5 3
5 3 1

He can jump like 5->3->1->0 without crystal . There is not written in statement that he can't skip any platform.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +25 Vote: I do not like it

    The statement also doesn't say that he can't teleport directly to 0 without using any platforms, but we don't entertain that possibility because the statement would tell you if that was possible.

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it +11 Vote: I do not like it

      But there is written that he can jump from x to x-2.

  • »
    »
    2 months ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it

    1

    5 3

    5 3 1

    at first you're at p5 (h = 5)

    then you hide p5 but p4 move out so h = 4

    hide p4 but p3 is also being hidden because p3 is moved out currently in this case you will fall to 1 which is Death (4-1 > 2)

    so you have to use magic to moved out p2, h = 2 now (after falling from 4, still alive because 4-2 <= 2)

    when h <= 2 you can just jump to 0

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Why can't he jump directly to 3? He won't die, right?

      • »
        »
        »
        »
        2 months ago, # ^ |
          Vote: I like it +3 Vote: I do not like it

        he can't jump to 3 because when he hides p5, p4 will show and block him to reach p3.

        it's said that when you try to switch pi, pi+1 will also be switched depend on whether it's hidden or showed.

        the only way he can jump from p5 to p3 if p4 is moved out. so when he hide p5, p4 will also be hidden

      • »
        »
        »
        »
        2 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        There's no concept of jump. Its just fall , once you pull the lever you fall from current height to the just lower height which has a platform , but if you fall more than a height of 2 you die.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    first he at 5 when move 4 opens so he doesn't go to 3 now he at 4 when move 3 closes and he couldn't go from 4 -> 1 must open 3 or 2 with crystal. the trick is that if he fall 2 is ok means he can't fall more but if next one is open he couldn't fall more! 5 can't go to 3 as 4 is open in between.

»
2 months ago, # |
  Vote: I like it +73 Vote: I do not like it

»
2 months ago, # |
Rev. 2   Vote: I like it +27 Vote: I do not like it

Terrible statements in C and wrong statements in B, D and F. 10 Announcements to explain and correct the questions. 30 Mins of DDOS attack and 100 pages of Queue.

If this does not call for an unrated round, i dont know what is!

»
2 months ago, # |
  Vote: I like it +51 Vote: I do not like it
Спойлер
»
2 months ago, # |
  Vote: I like it +3 Vote: I do not like it

In problem D, you have to count the number of ABBBB..., BA.... strings (bad string) right and then subtract from the answer right, am i missing something ?

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    Yeah, we count AB..B, A..AB, AB, BA..A, B..BA, BA

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +14 Vote: I do not like it

    Also, do not double count the strings like AB and BA.

»
2 months ago, # |
  Vote: I like it +34 Vote: I do not like it

DDOS + BAD problem statement ruined the contest

»
2 months ago, # |
Rev. 2   Vote: I like it +11 Vote: I do not like it

Since the cf-predictor says that I will get -1 as the result of this contest, I think that I'm objective enough to talk about this accident.

And in my opinion, this round should be UNRATED, because you can't evaluate how such accident impact participants' emotions and attitude toward this contest. For instance, this contest start at 22:35 in China, so some people may go to bed when they see "DDOS" at nearly 22:45. And it's clearly that most of them just pass problem A eventually.

»
2 months ago, # |
Rev. 5   Vote: I like it -20 Vote: I do not like it

Congrats with living today!!!

»
2 months ago, # |
  Vote: I like it +8 Vote: I do not like it

I like this kind of statement.

"Hooray! Today we've survived another DDOS attack. The round was not perfect, but it was not ruined!"

»
2 months ago, # |
  Vote: I like it +17 Vote: I do not like it

Is it technocup second elimination round?

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I will request to move it unrated. I was disappointed by the reloading and left the contest to do other works.

»
2 months ago, # |
  Vote: I like it +10 Vote: I do not like it

Misread D and wasted 1 hour coding QQ

  • »
    »
    2 months ago, # ^ |
      Vote: I like it -21 Vote: I do not like it

    It is not mention in the problem that good strings will also have length greater than 1

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      It has to be a length of more than 2,other wise you can not find a suitable palindrome for each letters. Because the minimum length of a palindrome is 2(according to statement)

»
2 months ago, # |
  Vote: I like it +4 Vote: I do not like it

My 2 cents considering problem D:

Most people solved this by counting bad substrings and subtracting their amount from all total substrings. But, you can also just count all good substrings. Notice that all characters in a string, except for the first and the last, have to be part of a palindromic substring. Why? Well, consider a letter which is not the last or first with two neighbors (we will consider A because B can be proven in a similar way) ?A?. For it to not be in a palindromic substring of length two, it's neighbors both must be B — ABA, but this results in there being a palindromic substring of length 3, which proves our thesis. So we only need to consider the first and last character. In the case that the first and last character are the same, the substring is OK (you can prove this in a similar way as we proved that all letters in the middle are part of some palindromic substring). But what if the first and last characters are different? Well, that means that we need to have at least two A's and at least 2 B's in the string for it to be correct, because since they are not the center of any palindrome of length >=2, we will need a character which is the same at some other point in the string.

We can count the number of substrings with the same letters on both ends by just pairing all A's and all B's, and we can count the number of substrings which have different letters on the ends with a simple sliding window and suffix sums of A's and B's, so the total time complexity will be O(n).

»
2 months ago, # |
  Vote: I like it +3 Vote: I do not like it

I was stucked with BAD GATEWAY problem in the middle of the contest. The authorities really managed it well to keep the round rated inspite of the DDOS attack.

»
2 months ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

I like codeforces contests, but last 2 week we used to handle a lot of technical problems during contests, but not solving tasks. Please dont test your defence againts DdOS during contests. If you are not sure that contest will be held in normal conditions — dont start it. People are getting a lot of rating changes for nothing

»
2 months ago, # |
  Vote: I like it +6 Vote: I do not like it

What is the hack for B?

»
2 months ago, # |
Rev. 2   Vote: I like it +80 Vote: I do not like it

I think it is a battle of ego now, if they make it unrated, the attackers win again, despite if cf's efforts to handle it.

»
2 months ago, # |
  Vote: I like it +30 Vote: I do not like it

I think that a lot of people are requesting to make the round unrated because they left the contest. However, a participant must take responsibility of its own actions: I just can't leave a contest expecting it to become unrated because of people leaving it, that's not how the things work. The correct situation would be "The contest is declared unrated, then I can leave", not the opposite.

Anyways we are all hoping that these kind of technical issues with DDoS end soon to have well developed contests.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +7 Vote: I do not like it

    No, in fact I didn't leave the contest and my expected delta is +70. The point is that I still think that it is better to make the round unrated because a lot of people probably left because immediately after you see that there are some technical problems you start thinking about leaving I mean you just lose motivation for doing a contest because there is a high chance of a contest ending up in a big queue and I mean just being a complete shit. So, the whole point is that probably a lot of people have left and I completely agree with you that it has been their responsibility, but again imo somebody's rating should show their real skill, so it does not make sense to make this contest rated.

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I agree with what you say, but by my experience (which made me not to leave the contest), there have been previous rounds with similar situations and the fact of people leaving the contest didn't matter in the end and they still were rated.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    I didn't leave the round. I got a PDF and solved all the problems that I could solve offline (after the acceptance of A).

    It's the round that left me. I can't consider it fair for me if the round is rated.

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it +14 Vote: I do not like it

      In your case you might request to make the round unrated just for you (I guess you'll need to give a lot of evidence of your situation), since it would be way unfair for the others to make it unrated just because your network broke down.

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      Upvoted your comment, only because you play Dota!

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

How can i get rid of A read-only mode ? Please help me.

»
2 months ago, # |
  Vote: I like it +5 Vote: I do not like it

How to solve problem D? what is logic for the problem?

»
2 months ago, # |
  Vote: I like it +6 Vote: I do not like it

Why DDOS again? Who are these people who attack on educational sites like codeforces??

»
2 months ago, # |
  Vote: I like it +31 Vote: I do not like it

is it rated?

»
2 months ago, # |
  Vote: I like it +9 Vote: I do not like it

I think we should discuss about problems, thats more important...

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Problem A: test case 2: 42 32

In the note it said that: you cannot choose p=7, subtract it, then choose p=3 and subtract it again.

Can anyone explain why it's not possible?

»
2 months ago, # |
  Vote: I like it +2 Vote: I do not like it

I can't understand what is good string in D! Can someone please elaborate

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    string is good if all it's characters are in palindrome substring of this string

»
2 months ago, # |
  Vote: I like it +2 Vote: I do not like it

Can anyone tell me what actually asked of problem C. I am trying to understand the problem statement for a long time but still didnt understood. Thanks :)

»
2 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Why does greedy work in C?

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +2 Vote: I do not like it

    Because you have only one way to move by using lever, "which switches the state of two platforms" so you don't have any options for minimizing or maximizing. ( when you can't move you have to increase your answer by one with no other options )

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I don't think the problem statement for C was too confusing. It was easily comprehendable with the common sense and the sample cases. This, in any way, should not be the reason to make it unrated imo. The DDos attack also didn't affect much as the site wasn't down for long. Still the extra 20 minutes make up for that.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it -13 Vote: I do not like it

    I have a little mistake in problem B i wait 20 minute queue so if the verdict of my solution come quickly i will repair the mistake in 2 minute but thx for queue so i see my codes get wa after 20 minutes.

    I always say that codeforces is the best site for coding but last 2 contest is really bad please check your problems before contest(like statements) and upgrade the system.

    Or change the site's name. pls do it www.queueforces.com

»
2 months ago, # |
  Vote: I like it +1 Vote: I do not like it

I came up with a idea to solve Div 2C by using a map, but it gave me a MLE on TC 6, can someone please help me code

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Actually consider the case when there is no block beneath our current standing platform, then what will happen is when we will pull out our lever then a platform just below will open up and this will continue till there was actually a platform earlier. So I think you do not have to decrement h at each step by one rather than you do platform_height[i+1] + 1, where i was our previous location of the platform. Hope this might would help

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I submitted B at 41 mins. My friend submitted at 16 mins. But unfortunately he kept C as his language whereas he coded in c++. He noticed that and corrected it but thanks to the ddos, it was 47 mins gone already. So I was actually ahead of him the whole time. That's the POWER of queueforces.

»
2 months ago, # |
  Vote: I like it -21 Vote: I do not like it

Most of the time I can solve at least A. Today I couldn't. And then there were some clarifications too.. This round should be highly rated so that i can be newbie again!!! And please down vote my comment.. It will be a complete package!!

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

After realizing that I couldn't connect any site of Codeforces (m1 or m2 inclusive), I received the problemset in PDF from a kind friend. Then there was a short break that I was enabled to submit code through m2. However, after A had been accepted, my network broke down again and I couldn't load any page until the contest was over. I solved ABCE on my own computer and had no idea about my rating. Could this round be unrated? I'll appreciate it if so.

:(

»
2 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

net upvotes of rnd 74

The previous Educational Round had a net upvote of +298.

Rip Pikmike's contribution :(

»
2 months ago, # |
  Vote: I like it +9 Vote: I do not like it

Codeforces has repelled the attack, uraaaaaaaaaaaaaaaaa!

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

can someone explain solution of problem A

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    If x minus y is greater than 1, the use of prime factorization can ensure that the result of x minus y must be able to separate a prime number p (x-y = np, n >= 1), which is equivalent to x minus n*p to get y. But 1 is not a prime number that x — 1*1 = y isn't accepted.

  • »
    »
    2 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    The question is if (x-y) is dividable by a prime number. If (x-y) is a prime number, then it is, obviously. If (x-y) is not a prime number, then it is, too. Because the defintion of a "not prime number" is to be dividable.

    So, the only number not dividable by a prime number is 1, since the smallest prime number (the problem states that) is 2.

»
2 months ago, # |
  Vote: I like it +33 Vote: I do not like it

In $$$E$$$, many (including me) thought about building the permutation letter by letter and using $$$DP$$$ to optimize the complexity from $$$m!$$$ to $$$2^m$$$, but got stuck in determining the contribution of each newly added letter in the total cost, as this would apparently require knowing the positions of the previously added letters. If anyone still doesn't know how this problem is overcome, this may help:

These are $$$2$$$ ways to calculate the cost (summarized from some people's solutions and ideas):

Let $$$cnt[i][j]$$$ be the number of times letters $$$i$$$ and $$$j$$$ appeared next to each other.

1) Whenever you add a new letter, loop on every not added letter $$$uc$$$, and add $$$cnt[uc][ac]$$$ for all added letters $$$ac$$$. This is due to the fact that cost can be decomposed into units, which are added dynamically at each position.

2) For any $$$2$$$ letters $$$i$$$ and $$$j$$$, where $$$pos_j>pos_i$$$ in the permutation, the contribution of $$$(i,j)$$$ in the total cost is $$$cnt[i][j]*(pos_j-pos_i)$$$. Therefore every newly added letter $$$nc$$$ contributes in the total cost by $$$cnt[nc][ac]*pos_{nc}$$$ for all already added letters $$$ac$$$, and $$$-cnt[nc][nyc]*pos_{nc}$$$ for all not yet added letters $$$nyc$$$.

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

It just should be unrated, I think. Last night was so bad for people like me.

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

what is the slution for codeforces "A read-only mde"?

»
2 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Please make this contest unrated. Many people suffered due to this.

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

this is how cyber expert challenges software engineer

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

So finally what's decided? Is the contest rated or not?

»
2 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

deleted

»
2 months ago, # |
  Vote: I like it +19 Vote: I do not like it

When system testing start ??

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

It was good for me that I didn't see the announcements before submitting C.

I started the contest may be after 20 minutes. Codeforces wasn't loading then for me. I tried m2.codeforces.com and it worked. I straightly went to probelm C. After 1 hour 17 mintues I submitted C. Before being accepted I tried opening original codeforces.com and it also worked. Till then I hadn't seen the announcements. I became afraid but my submission got accepted. A and B also got accepted. No wrong answer. If I would have seen the announcements earlier it could be a disaster for me.

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Editoral ? wanted to know how F can be solved in single dfs traversal.

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

So will the contest be rated in final?

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I got really affected by the attack. It is cool that codeforces managed to control it but anyway i submitted B and only after 30 minutes got the WA veridict. Also it got submitted 2 times in a row. I left the contest and then returned after some minutes randomly and it was already repaired. Maybe you can make it unrated for those who will decrease in rating, anyway i think that next rounds everything will go a lot more smoothly.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yes, it's rated, and I -62 became expert.

»
2 months ago, # |
  Vote: I like it -7 Vote: I do not like it

Question: How to get upvotes for a blog that is being downvoted by almost everyone?
Answer: Ask Mike Mirzayanov to write a blog post requesting everyone not to downvote the blog.

P.S.: It's just for fun. Nothing serious. I (and many) appreciate the efforts put into by the Codeforces team to tackle the DDOS attack.

»
2 months ago, # |
  Vote: I like it -8 Vote: I do not like it

Why system testing is so slow nowadays ?

»
2 months ago, # |
  Vote: I like it -7 Vote: I do not like it

When is the rating usually recalculated after edu rounds?

»
2 months ago, # |
Rev. 4   Vote: I like it +1 Vote: I do not like it

Used "Arrays.parallelSort" instead of "Arrays.Sort" in problem B to get rid of "UWI"-hack, but it gave TLE on case-19. Too much pain for JAVA users!! @ pikMike

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I used Collections.sort(). It sorts in O(n log n) time in worst case. But I still got TLE on case 9. What were you supposed to do? Counting sort?

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it +35 Vote: I do not like it

      The problem in your solution is not a slow sort, but slow output. System.out.println() always flushes the data, that's why it has problems with printing $$$10^5$$$ integers one per line. In that cases you can use PrintWriter instead (but don't forget call its close() function, since it can just forget to flush output).

      • »
        »
        »
        »
        2 months ago, # ^ |
          Vote: I like it -10 Vote: I do not like it

        Thank you very much. I didn't suspect it to be the output since I usually run into that Problem at about 10^6 output lines. When will I learn!?

      • »
        »
        »
        »
        2 months ago, # ^ |
          Vote: I like it +1 Vote: I do not like it

        Also, I used PrintWriter instead of System.out...!

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it -10 Vote: I do not like it

      Taking Integer[] array instead of int[] array also works for Arrays.sort(). Most of the time Arrays.sort(int[]) gets time limit exceeded. Arrays.sort(Integer[]) works normally.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +21 Vote: I do not like it

    I don't use Java but here you go what I understood from the last 1203912039 times that it happened:

    Arrays.Sort can be O(N^2) for primitive types but it is O(NlogN) always for non-primitive types. So you can just wrap what you want in a class or something and it can't be hacked.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Nobody forces you to code in Java. You select language on your own and should be aware of such language details.

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

will it be rated?

»
2 months ago, # |
  Vote: I like it -14 Vote: I do not like it

Why all python submissions on B got hacked? 62157133 Is this because of slow input? How can I avoid it?

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I'm afraid so. Actually I remove the set() method and implement a unique function by myself (linear complexity, I thought it may faster than using set() method). And I submitted in PyPy3, it should faster than py3. And I got a TLE in test 7. 62193391 . Perhaps you should use C++ instead.

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it -10 Vote: I do not like it

      If you look at the test case you can see its input is like this: 100000 1 1 1 1 1 1 ...

      so i think reading 100k lines makes some big overhead.

      • »
        »
        »
        »
        2 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Well,,, I 've found the way to accelerate the input, just add import sys;input = sys.stdin.readline in front of the code...

»
2 months ago, # |
  Vote: I like it +18 Vote: I do not like it

SlowForces

»
2 months ago, # |
  Vote: I like it +16 Vote: I do not like it

When will they update the ratings?

»
2 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I have a question.
I submitted two codes to A and B.
I hacked the second one is each task and I still have AC.

So the first AC is the final one? Or the best one?

MikeMirzayanov PikMike ?

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +6 Vote: I do not like it

    I once asked a clarification about this, the first solution that gets AC is counted. And if you resubmit and your first solution later fails, but second gets AC, you get AC.

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      ohhhh
      thanks

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Does this happen for all types of rounds?

      • »
        »
        »
        »
        2 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        No, only ICPC style contests, so educational and Div.3 I think too

»
2 months ago, # |
Rev. 4   Vote: I like it -10 Vote: I do not like it

Hi — My code has been plagiarized by user my_name_is_khan. This user is malicious and has a history of ripping off other people's code as you can see from their submission history here. I request MikeMirzayanov, PikMike, and Vovuh to please restore my solutions and rate me for this contest. Also, I request you to take steps to ban such hostile users. Thank you.

»
2 months ago, # |
  Vote: I like it +8 Vote: I do not like it

Could somebody explain how to solve Problem F?Thanks :)

  • »
    »
    2 months ago, # ^ |
    Rev. 2   Vote: I like it +5 Vote: I do not like it

    It is easy to notice that your graph will always look like a single chain, and any vertex of this chain can have some "leaves". So your answer will be always a graph like this:

    Image

    Where vertexes from 0 to 7 I call body vertexes and others are leaves.

    In order to find this tree you have to launch a dfs from one of body vertexes and $$$ans(x) = max1(ans(son_1), ans(son_2), ...) + max2(ans(son_1), ans(son_2), ...) + sons.count$$$, where max1 — first maximal among sons, max2 — second.

    But we cannot launch dfs from each vertex and select the best answer, so you can think a bit how can you calculate it using two only (or 1) dfs.

    I hope the main idea is clear.

    • »
      »
      »
      2 months ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      Thanks for your clear solution!

      But I want to figure out a fact that for a valid tree.Except the root can have two sons which are not leaves, other nodes in the tree can only have at most one son which is not a leave. So you should calculate another value for every node that if the node is not a root then what's the maxsize tree of it to get the correct answer. The formula in your post is almost correct except that the meaning of the "ans" on the left is different from the meaning on the right. You can use just $$$1$$$ dfs to solve it.:)

  • »
    »
    2 months ago, # ^ |
    Rev. 2   Vote: I like it +1 Vote: I do not like it

    Let's fix the root of the optimal sub-graph. Let's define two types of segment for each node — a point segment(where only this node is used in optimal sub-graph) and a batch segment(where this node along with its its subtree childs are used). Assume fixed root has batch segment, then we can use atmost two types of batch segments which intersects with segment of root and infinite point segments. For all non-root nodes we can use atmost one batch segment and infinitely many points one. This may be not clear to understand because of my explaination but maybe this picture can give you an idea — (https://imgur.com/HPwMhoi) This is simple DP. Details in my code. But root can be any node not just the one we selected initially. Assume child of above fixed node is new root then either previous node will add as point segment — we can add 1 to dp[new_root][0] otherwise it act as a batch segment then we can just swap two batch segments of new_root and prev_root and hence this value will be equal or maybe there exist a rerooting parameters(?).

»
2 months ago, # |
  Vote: I like it -8 Vote: I do not like it

After ac problem A I can't submit my solution for B. Then I closed codeforces when I saw "ddos attack". finally,my rating got -157. rediculous :)

»
2 months ago, # |
  Vote: I like it +9 Vote: I do not like it

Why is there no tutorial?

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Why is this contest rated??! it's unappropriate!

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve F?

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Is there any editorial for the round please ?! I got stuck with many problems in the contest thanks in advance

»
2 months ago, # |
  Vote: I like it +5 Vote: I do not like it

Thanks for fast editorial

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Since the tutorial is not released yet, can anyone briefly describe their approach to problem G?

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

make educational codeforces a weekly event , a request

»
2 months ago, # |
  Vote: I like it +6 Vote: I do not like it

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

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

how is it possible in educational round become failed with out any successful hacking attempts ??!!! does it have any extra system test ??