As an experiment the Educational Codeforces Round 33 will be rated for Div. 2. ×

By MikeMirzayanov, 2 months ago, translation, In English,

I apologize to the participants of the round. It happened that I accidentally had run improper script and it rebooted the judging machines. It is very insulting, because most problems were proposed by me and I hoped to host an interesting competition for you. A lot of effort was spent on preparation. Apparently, the mistake of just such a human character happened for the first time. I really hope not to repeat it in the future.

MikeMirzayanov


Want problems? We have some!

Codeforces Round 434 will start on September 17 (Sunday), 13:05 (UTC). It will be based on Technocup 2018 Elimination Round 1. So, if you are a Russian-speaking high-school student, please take part in the Technocup 2018.

Many thanks to KAN, 0n25, Ne0n25, ifsmirnov, irkstepanov and white2302 for their help in round preparation. Some problem ideas are mine.

I hope you will like problems. There will be 6 problems in div. 2 and 5 problems in div. 1.

Wish you good luck and bugless code.

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

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

you forgot to thank MikeMirzayanov

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

Mike himself to the rescue B)

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

And thanks MikeMirzayanov for the codeforces platform,great polygon and also for this post.

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

Is it Xxxxx ? (Please no downvotes)

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

Is this contest only for a Russian speaking student?

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

    It is open for everybody.

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

      Hmm..Thanks

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

        can i be your friend. can you help me when i get stuck in some problems.

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

          No i didn't mean in contest. please stop down voting.

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

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

this round will be rated or not ?

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

Sorry for bad knowledge of codeforces, but will there be hacks in the official round?

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

I hope it will have begineer level A like yesterday... ;-)

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

is it....emmm, interesting ?

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

Please announce the scoring!

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

    They didn't say, they will. :D

    As soon as the contest starts, you can see it both on standings page, and on the right bar.

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

MikeMirzayanov, hack page is not loading. :(

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

My solution is 'running on pretest 1' since 15 mins.

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

testing system is stuck

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

Such a long queue...!! I guess round should be declared unrated...

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

Experiencing Queue on hacks for the first time

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

What would happen if two person attempt to hack a code simultaneously when there is a queue on hacks ??

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

    Both get the points..!! hahahahahhaha

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

Is Codeforces mining bitcoin?

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

Will it be unrated?

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

    Good news or bad for you..??

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

twenty minutes to receive a "Memory limit exceeded on pretest 1", RIP points

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

    Submit it after debugging again and you will not receive anything as contest would be over by that time..!

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

    Similar happened to me.

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

    Exact same happened to me.

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

such a long queue :( waiting since 20 minutes.

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

Well, this queue is unresonably long...I must say

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

This contest

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

Long queues... So most likely this contest is unrated.
Moment of silence for all our brothers/sisters who realized this news after 2+ hours on this contest, as they were only giving the contest to increase their rating.

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

for sure it is not rated, is it ??? I submitted a solution 15 mins age, but until now it is in queue !!!!!!

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

In queue...

after the contest end

Wrong answer on pretest 7

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

My Rating Graph clearly depicts the guy who is the mayor of the friendzone.
I was about to break it through the friendzone and get laid today finally but long queues will most likely result in declaring the contest unrated.

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

My 2D works OK on my computer but WA on CF, WTF

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

Please make this round unrated. I still don't know whether my solutions have passed the pretests or not.

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

    Now it showed me wrong answer on pretest 7 for E problem now and time is increased by 10 mins. So much of adrenaline rush !!

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

I waited for 30 minutes, but my code is still in queue. :(

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

Up vote this comment if you like this round to be unrated. Down vote other wise.

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

Yeeey, another unrated round, haven't seen for some months...

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

I'm alone who's sad that round isn't rated?

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

What happened on the juding system? I have participated in some rounds(and watch some) recent two months and found almost half of them get stuck in queue after 1 hour of the contest. What is the bug of this system? Could it be fixxed some time? Very eager to get a fluent contest without waiting for In queue and in queue and in queue..... Or finding the 404 and 403 and 504 and so on.... Hope Codeforces will be a better Online Judge System/

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

A sad story.This round is unrated...

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

Well, now I don't have to worry about my submissions failing systests because contest is unrated anyway :)

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

Unrated :( Rip top 20 :( Huhu

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

I was gonna have a +120 rating change :(

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

I sumbit 2B with the same code for twice, and heres the results.

30437680

30439382

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

How to solve Div.2 A?

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

    contest isn't over yet.

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

      Oh sorry, I had an old tab open with the time before it was extended.

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

        Lol finished A on my IDE and tried to copy/paste before realizing that I forgot to sign up for the contest...

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

        And I think you just brute force it.

        e.g multiply n by 1, 2, 3, 4... 10^k

        Where if n* 1, 2, 3, 4 .. 9 is not a k'th rounding, print out n * 10^k as numbers expressed in k'th rounding will never have primes larger than 9 in their factors.

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

    Isn't answer just LCM(10k, n)?

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

    my idea for A is: since number of zeros in the end is the minimum of powers of 2 and 5 in a number, I calculate the powers of 5 and 2 that are in the number, and I put more 2's and 5's as needed to make the minimum of powers of 2 and 5 at least k, for example n = 375 and k= 4, 375 contains 3 fives and 0 twos, so I add 4 twos and 1 five (2^4 * 5^1) = 80 and multiply it by 375 = 30000

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

Finally, my solution for D passed after 30 mins. What a happy story!!!

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

Really didn't expect this after yesterday's contest, especially considering how the system tests took like 10 minutes. A lot of people have to wait longer to get their submission judged than that entire system testing took. These sort of issues are really unfair on everyone, unfair on those who did well because they won't increase in rating, and unfair to those who got stuck in the 30 minute queue.

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

Well still no red for me :')

(Ehh why always when I do ok on a round it becomes either unrated or I have a stupid bug and one of my solutions fails)

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

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

    This...except I solved only 3

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

    your fourth submission pretests are still in queue. Hoping for your statement to come true soon. My E is also waiting.

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

    Perfectly described me.(P.S.:with +1:-3 Hacks by the way)

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

    Same opinion in Div.1...

    The first time for me to be in top 50...but unrated...

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

You know you are a programming competition addict when you get your best rank, and you come to know that the contest is unrated(at the end of contest), and still you are alive.

»
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

I unaccepted 2B 4 times. thanks for the unrated. I don't worry about my rating!

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

Looks like problem F from this round and http://codeforces.com/problemset/problem/406/C are the same.

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

Will it take a lot of time to system test? I want to go to bed because it's midnight in my country...

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

    As I understand, the intended solution there is something called "string hashing". Does "string hashing" mean just cramming it all into a hash table as I did (and got AC) or is it supposed to be something more clever?

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

Can someone explain, why is this incorrect?(Problem D, wa 1st test) https://pastebin.com/gihJ16VG

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

div1B is bad in my opinion. Just many maps/sets/hashsets will pass, although trie is intended(at least I think, that it is).

UPD: And it's already well-known problem, link is 2 comments above.

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

    Why do you think solutions that require hashing are bad?

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

      For this platform it's bad, because most probably it can be hacked. For instant full feedback contests it's fine.

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

        Well for this problem if we do polynomial hash with base 13 it will fit in a 64-bit variable so I don't see how it can be hacked.

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

        Even for this platform using for example polynomial hash with 4-5 random prime bases and random prime moduli, it may fail, but not by hacking.

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

      Because it's too easy for a Div1 B when you can very easily use map and set from C++

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

    Yeah, seems solutions with map gets pretests with 3500+ms, but I think they will fail at system tests...

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

      My unordered_map solution ran pretests in 1.38 sec

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

      I used unordored_map and it passed in ~2700ms which has a decent chance of passing system tests

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

      I doubt that. There are only at most

      values to hash, and I don't think calling map, set, etc. that many of times would exceed the time limit of 4 seconds.

      • Edit : edited after checking the problem parameters.
      • »
        »
        »
        »
        2 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        no

        it is at most 45 * 7 * 10000 not 36 * 7 * 10000

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

          Yes, I think your right. My notes do say 10C2. I forgot the problem parameters. But it doesn't change my argument that this is reasonable within the time limit.

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

        Yep. It does pass.

        30433941

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

    I have a tricky solution. Using map with substring of length 8, for substring of length less than 8, just use array[2.10^7]. :)

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

My logic for D was -- for every suffix of a given string insert it into the trie then for ans for each string for every starting position calculate the depth of the position where trie[node] has only 1 index Can someone tell whether this logic is correct cuz I got WA.

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

    I did that, so it should work. Was tricky to not run out of memory though.

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

What is the pretest in div2 B?

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

    2 2 3 1 5 2 answer =1

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

      this should give '-1' right?

      my code didnt pass the pretests and i dont know where i'm making a mistake :(

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

        if you know the third flat is on the first floor, on which floor is the second flat?

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

    How Can Someone Know before the systest finishes?

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

How to solve div1C/div2E ?

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

When s̶y̶s̶t̶e̶m̶ pretest testing will be finished?

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

I'm really disappointed ! Just spend the whole evening and the contest was unrated !

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

    Well...I think despite the slow judgement,spending whole evening enjoying the problems themseves is OK.(Maybe I'm too weak to say that,but we do these problems to improve ourselves and get progress as well...

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

I Think This Round Should Be Rated And Used This :- New_Rating = Old_Rating + max(rating_change_that_was_going_to_happen, 0);

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

    It is very bad idea, also not fair...

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

      Why Not? Explain Please.

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

        Everyone had problems in this contest, so rating must be changed or not changed for everyone.

        One little update: Someone has rating ~1890 and with rating change he will be ~1910, but if there was not long queue in contest, s/he could make 2000+ rating which is better, because with 1910 rating you will fall expert if you write bad in your first contest, but this doesn't happen with 2000+ rating...

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

        Think for next contests, they are wrong again and we will continue to apply your formula and what will happen? Maybe all coder will have rating > 1900. All people will join Div.1 !!! And maybe I will get Red color soon :))))

        p/s: I solved 4 problems in this contest, but I don't care about rating.

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

          I Talked Only About This Contest. Mike Said This Is Not Going To Happen Again.

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

    instead of spamming these illogical comments. Do some practice your rating will increase for sure

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

    Taking such measures often enough would lead to unnecessary rating creep.

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

UPDATE: the problem was just casting. Works as expected in GNU G++14, but not in GNU G++11.


So, there is a weird bug with the GNU C++11 compiler... I was getting TLE in pretest 1 with http://codeforces.com/contest/861/submission/30432329 I got it solved by removing the pow call: http://codeforces.com/contest/861/submission/30432756

pow(long long, long long)

pow(10LL, k), where 0 <= k <= 8

Doesn't seem to ever exit the function... but works fine in every other environment I've tested. Waiting for the end of system testing so I can make sure it's really the pow, and only in GNU C++11.

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

    pow() returns a double, not an integer or long long

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

      UPDATE: okay, so I tried it and you are right, pow is returning. The problem is exactly the cast. In GNU G++11 (long long) pow(10, k) turns out 10^k - 1. In GNU G++14, however, it works as expected.

      I should have been more careful. Not the first time I have a problem with double -> int casts, and I keep making the same mistakes :).


      Since submissions can't be seen until the end of system testing, this is the line: long long k10 = pow(10LL, k); // k is a long long

      Even if it returns a double, it's then casted to a long long. The point is, it never returns, so it doesn't even matter what it returns...

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

        How do you know it never returns?

        Have you tried with CUSTOM INVOCATION?

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

          Custom invocation was not working (would run forever with any code I submitted), but as soon as it started working again I tested it and now I know it is returning. The problem is the cast.

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

Todays contest be like

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

When you finally did ok on a round

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

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

I made a video explaining my approach to problem div 1 a div 2 c https://www.youtube.com/watch?v=p4JGd5g9K9o&feature=youtu.be

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

After waiting for 10min, my long-queued submission turned out to be WA on pretest 2.

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

This all happened because there is no thank for Mike in announcement... :(

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

    What is the pretest 3 of div2.b?

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

      I don't know this test, but here is why you got WA3:

      When you check if you found another count of rooms for each floor, don't print -1 immediately, also check if n is not in the same floor with previous answer.

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

top 100 get shirt?

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

I'm pretty curious, but what sort of technical errors can lead to a round being unrated? Like, I think with the timestamps of all submissions, rating modification is always possible (as long as the contest setter intends to do so).

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

    What about if I waited for 30 mins for checking my solution then got WA and realized little bug immediately? 30mins is 1/4 of contest...

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

      Ah... I got it now. I did feel the same thing when waiting for problem D, at least it turned out good (not sure if it could withstand the system tests). But okay, thanks.

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

      i see, but i was going to be an expert if this round is rated

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

        It happens :) Just think what top10 feels now.

        BTW, I was going to be expert also :P

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

MikeMirzayanov your apology is accepted :3

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

For problem F, would it be right to say the following? Construct a new undirected graph where the edges from the input graph are considered as vertices and if any two edges in the input graph are incident on some same vertex, then connect them in the new graph. The vertices from the input graph are not considered in this new graph. Now find the maximum matching in this new graph. This gives the answer. I know this won't work even if it is correct but I just want to know if this reduction is right. Thank you!

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

    This reduction is correct. Nevertheless, it cannot get AC, because in some cases it requires constructing too big graph. For example, imagine a test with n=100000, m=99999 and with edges {1,i} for each i from {2,3,...100000}. Then your sollution needs to contruct a new graph consisting of m*(m-1)/2 = 4999850001 new edges, which is far too much to hold in memory without getting MEM/RTE. Your sollution's expected time complexity is O(m+n+E*logm), where E is the number of edges in new graph, which is enough if E doesn't exceed 10^6. However, due to the fact that E can be O(m^2), pessimistic time complexity of your sollution is O(m^2*logm), which is too slow to be able to pass all tests.

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

test 43 on Div1C?

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

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

My one of the best performance, but unrated :(

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

    me too.

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

    Yes, for me to. It should happen more often, I perform better unrated.

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

When can we submit the code in Practice. Can not currently :(

Update: We can submit now :')

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

    Apparently Mirzayanov has accidentally rebooted the Practice machines too.

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

    now, finally :)

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

When will the editorial be posted?

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

    I think I have solutions to everything in Div 1, even though I couldn't get them to work in the contest. Here's the short, short editorial:

    A: Greedily extend the current word until adding another letter would violate the condition. Constraints are low enough that you don't have to be particularly clever (I think my solution is O(N^2) even though linear is quite easy).

    B: Make a frequency table of how many words contain each substring. You have to be a little careful because a substring might appear twice in one word. Then for each phone number, check every substring in increasing length until you find one that only appears in that number.

    C: Make two lists of initial filenames (examples and other), say I0, I1 and target filenames (examples and other), say T0, T1. Any file that already has a valid target name for its type gets crossed off both lists. If I0 == T1 and I1 == T0 then you have to rename some file to a temporary to break the cyclic dependency. After that or otherwise, you can always find some target in T1 \ I0 (or T0 \ I1), and then pick the source from I1 & T0 (or I0 & T1) if not empty, otherwise any from I1. You can prove that applying this renaming is safe and will again allow a subsequent renaming.

    D: In each component it's always possible to use half the edges. In fact, it's possible to picks off episodes such that the component remains connected. Build the DFS tree. Where a vertex has two up-edges, combine them into an episode — removing up-edges won't affect the DFS tree. Now pick the deepest leaf, picking one with an up-edge if possible. There are a few cases to consider, but it's always possible to use the edge from the leaf to it's parent plus some other edge in a way that won't disconnect the tree.

    E: I'm using a heavy-light decomposition and small-into-large merging. My solution was running out of memory (it turns out a deque per node uses a surprisingly large amount of memory even if they're empty), and I want to check if it's fast enough before posting my approach — I'm not 100% sure it is actually O(N log N).

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

      There is a near-linear solution for E using LCA and a stack.

      30443098

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

      Your solution seems to be O(N*sqrt(N)). The code below gives test cases where your solution performs a little over 0.6*N*sqrt(N) calls to push_down. I think that is about the worst you can do, since only the push_down call on the heavy child seems suspect (I think) and because of the merging of light childs before it, it seems a vertex can receive at most O(sqrt(N)) such calls.

      int n = 500000, d = 0;
      while (3 * n - 3 * (d + 1 + (d + 1 + 2)*(d + 1 - 1) / 2) >= 2 * n) ++d;
      vector<int> p(n);
      p[0] = -1;
      FORE(i, 1, d - 1) p[i] = i - 1;
      int at = d;
      REPE(i, d - 2) {
      	int prv = i;
      	REP(j, d - i) { assert(at < n); p[at] = prv; prv = at++; }
      }
      while (at < n) p[at++] = d - 1;
      printf("%d\n", n);
      REP(i, n) { if (i != 0) printf(" "); printf("%d", p[i] + 1); } puts("");
      
      • »
        »
        »
        »
        2 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Yes, I'd also concluded that my solution is O(N sqrt(N)). Once I fixed the memory usage it passes system tests though, so the tests are probably not that strong. I think the push_down calls can be improved because they'll always operate on a contiguous range of the vertices at each level, so they can be made O(depth of light subtree) rather than O(size of heavy subtree to depth of light subtree).

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

Rating changes for contest: Div. 1, Div. 2, Технокубок.

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

Does anyone have an O(n log(n)) approach for div1 E ?

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

    Can you please share your approach.Solutions are not public yet.

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

    Yes, me. Also, it is possible to get O(N) if I use LCA in O(N) precomputation and O(1) query, but it's just theory. Add nodes in layers and construct the compressed tree with the current nodes and do some partial sums

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

When will we be able to see testcases/resubmit? I'm curious about WA76 in Div1C.

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

Simple O(n) Div 2 C solution in 20 lines in Java https://pastebin.com/siR9vnyt

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

I think using O(nlogn) for intended solution in 1E and trying to make O(nlog^2n) can't pass is not a good idea in cf :/

I thought O(nlog^2n) is really fast and submitted without thinking and got TLE in the system test.

UPD: resubmitted the TLE code without editing and got AC :/

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

i have an issue, my code pass div 2 problem D's pretest, then my code get time limit exceeded on test 3 when system testing, then i resubmit again after system testing, and ac,,, what is going on???

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

This is quite weird. My answer for div2 A here gives correct answer 30000 for pretest 1 on my system but is giving wrong answer 29952 on CF. What can be the reason? Any help is appreciated.

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

    pow() returns double, write one that calculates in integral type by your self!

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

      Thanks, that worked.

      But here both arguments are integers, then why should returning double be a problem (I am typecasting the result in long long)?

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

        Cause pow(base, exp) = {base}exp = (eln(base))exp = eexp * ln(base)

        This is how pow function implemented among almost every C++ compiler. Both functions ln and ex calculate result by Taylor series. So there always will be some error. If you want integral-type based implementation you should do it by yourself.

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

editorials please?

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

Can anyone please help in Div2C.I am constantly getting WA on test case 40.Here is my code.

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

    Try this input: dfacccbabc

    Output that you should be getting

    dfaccc babc

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

      I am getting "dfacccbabc" when i am running locally.I am not able to get my mistake.

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

        Yeh i get it. That's why i gave this input. So now you know what's your mistake, should be easy to correct i guess.

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

      I can not figure out , why the answer should be dfaccc babc?? Will you please explain?

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

        From what i can figure out this is your mistake-

        Once you're getting consecutive consonants which have all the same character you're printing all of them, which you shouldn't. Suppose you've got cccccba then printing cccccba is incorrect as you'll have a substring ccb which is a typo and should have been printed cc b or rather the whole string ccccc ba.

        Hope this helps :'). Haven't looked at you code but i'm guessing this is the mistake.

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

          Yes, absolutely. I understood my mistake.Thank you so much.

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

I submitted my TLE code for D after the contest and it gets AC. Can someone please comment on this?

TLE submission during contest: http://codeforces.com/contest/861/submission/30435774

Submission after the contest: http://codeforces.com/contest/861/submission/30459324

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

Editorial please!