fcspartakm's blog

By fcspartakm, history, 3 years ago, translation, In English,

Hello, Codeforces!

I'd like to invite you to Codeforces Round #354 (Div. 2). It'll be held on Wednesday, May 25 at 18:05 MSK (Moscow time) and Div. 1 participants can join out of competition. As usual round starts in the unusual time!!!

Me an Grigory Oxxxymiron Akhremenko prepared the tasks for this Round. It is the debut for Grigory as the problemsetter.

Great thanks to Gleb GlebsHP Evstropov for helping us preparing the contest, to Mike MikeMirzayanov Mirzayanov for the great Polygon platform and for Ilya IlyaLos Los and for Artur ikar Svechnikov for writing solutions.

The scoring distribution will be announced later. Good luck everyone!

UPD Score distribution 500-1000-1500-2250-2250

UPD2 Editorial

UPD3 Congratulations to the winners

  1. Thomas66

  2. super_wormy

  3. Valkata.a.k.a.TheHacker

  4. tcchung

  5. Karakotov

UPD4 See you soon!=)

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

»
3 years ago, # |
Rev. 3   Vote: I like it -165 Vote: I do not like it

Will it be rated? It is not stated so I think it's a valid question.

»
3 years ago, # |
  Vote: I like it -67 Vote: I do not like it

why in each time when GlebsHP helps preparing the contest , problem C be easy :p

»
3 years ago, # |
  Vote: I like it +28 Vote: I do not like it

Div. 2 only contest, which means loads of fake new accounts of Div. 1 people... :(

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

    This is bad. Those who are in Division 2 will not be able to rise, as will constantly play fake members of the first division.

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

      the people from the first division. Please participate only out of the competition!

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

    That's not true anymore. After the rating revolution the number of fake accounts decreased significantly. There was less than 30 new accounts in top-1000 in the last two div2 only rounds, and most of these are not fake for sure.

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

      Although there are just 30 new accounts, but many contestants of div1 have many accounts which had rated. So there aren't only 30 people of div1 use div2 account to participate this round.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Why?They can also participate with asterisk.

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

      Maybe because they love the feelings when their ratings make a big jump (who doesn't, right?)

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

    Like me :)

»
3 years ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

unlucky , i can't participate in this contest because the electricity power cut off from my home at start time of this contest .

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

It maybe my first contest in codeforces, good luck to everyone.

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

    Good luck, I think you are excellent and beautiful.

  • »
    »
    3 years ago, # ^ |
    Rev. 2   Vote: I like it -14 Vote: I do not like it

    I have a feeling you will rank the top.

    Let's see if I am right after contest.

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

      Just a feeling , take a look at his submissions and you'll be sure :D.

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

      You must take a mistake, and I am a newbie.

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

        You must be joking.

        I found you using advanced techniques in ur submissions.

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

          Mo's algorithm, I don't think a newbie know this algorithm.

        • »
          »
          »
          »
          »
          3 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Do you mean the mo's algorithm is advanced technique? I really just start to study Algorithm for one month....

          • »
            »
            »
            »
            »
            »
            3 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Okay...

            Good luck to you, xiao ai.

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

    Good luck. My first contest as well. :)

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

    This my 4th time to take a round. But it's my first time to find the round announcement before the contest... I wonder Why their is not a link to this announcement in the contest page...

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    we are at the same room...Are u a college student?

»
3 years ago, # |
  Vote: I like it +50 Vote: I do not like it

Is Delinur still a translator in Codeforces? I feel I haven't see her name in a round announcement for a long time.

»
3 years ago, # |
  Vote: I like it +32 Vote: I do not like it

Oh god, I have two university exams tomorrow :(

But wait a second, stupid university exams won't help me reach the AMC-ICPC :V :V :V

I'm in :D :D :D

»
3 years ago, # |
  Vote: I like it -12 Vote: I do not like it

This contest may become my debut. I looked at your profile and I saw you make contests with more than 5 tasks. Will this hold for today because I want to solve as many problems as possible?

»
3 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Can't wait to be a candidate master.

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

    So am I. Best wished to us. Good luck & have fun.

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

    You guys are pretty close becoming a candidate master. I still got a a lot of work to do! Best of luck!

»
3 years ago, # |
  Vote: I like it +14 Vote: I do not like it

Good luck to everyone:)

Hope you all have a great leap in your ratings(which is impossible)

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

My memories of usual Codeforces' rounds are fading... Usual time? haha! BTW I like contests being held at 8PM MSK. It's a good time for me. I wish it was the usual time.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I wish it wasn't, 8PM MSK is 1:00AM in my local. It's very bad.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      At least you can sleep less and participate, in my country it's 12:05pm. I normally work at that time. I wish it were at 1:00am, I would participate a lot more!

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

    I like this time too. I have high school students work on it and it is 11 am EST which is when the class is. It was perfect!

»
3 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Study for Exams or Codeforces Round? why am i even thinking about this :D I am in

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

    Good Decision! A few weeks ago I had the same problem. I decided to go for CF. Got 80+ ratings :)

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

Though I have an exam at University, I am not thinking about this. Absence in a CF round give me much pain than getting less mark in exam.

»
3 years ago, # |
  Vote: I like it +7 Vote: I do not like it

Damn I have 4 exams tomorrow... Shit I forgot I finished school

»
3 years ago, # |
  Vote: I like it -7 Vote: I do not like it

wow! problem D, E got the same score? D must be hard.

»
3 years ago, # |
  Vote: I like it +27 Vote: I do not like it

»
3 years ago, # |
  Vote: I like it -11 Vote: I do not like it
The comment removed because of Codeforces rules violation
»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

very easy problems

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

    Seems fine — only 249 people solved D and 105 solved E.

»
3 years ago, # |
Rev. 6   Vote: I like it -9 Vote: I do not like it

Nice contest.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    solve E ! it's the best problem also easy as E

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      E is easy if you know a thing or two about polynomials (namely, that the remainder when dividing f(x) by x - k is f(k)).

      However, I didn't find any non-annoying ways to check whether f(x) is divisible by x - k if all the coefficients are already known...

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        You can calculate it modulo a couple of random numbers or primes. That will nearly always work.

        I don't know if there is a nice way to do it without randomisation though.

        • »
          »
          »
          »
          »
          3 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          To check if f(k) = 0, note that f(k) = a0 (mod k). So a0 must be a multiple of k or f(k) cannot equal 0. So you can add a0/k to a1. Call this a1'. But then the new a1' must be a multiple of k or f(k) cannot equal 0. So now you can add a1'/k to a2.. and so on.

          • »
            »
            »
            »
            »
            »
            3 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Are you using floating point for this? Does that not give you issues with precision? Or alternatively, give you very large fractions?

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

              If a_i is not a multiple of k, the algorithm terminates. You only divide a_i by k if a_i mod k is 0.

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I don't know if it worked... but I just used python and did it in O(n) :D (python handles big integers)

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

          I'd love to see Python handling 10000100000 in one second...

          • »
            »
            »
            »
            »
            »
            3 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            If he used Python2, the multiplication would have just overflowed, and he may have been lucky that it worked.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Hodor :v :p

»
3 years ago, # |
  Vote: I like it +1 Vote: I do not like it

how to solve B?

  • »
    »
    3 years ago, # ^ |
    Rev. 4   Vote: I like it +5 Vote: I do not like it

    Create 2D array for your glasses, put T * CONST (e.g. 2048) water in first one.

    Iterate from top to bottom, layer by layer. For each glass substract all water that left (higher than your const), split it by 2 and add to two glasses on the bottom layer.

    Count how many glasses have >= const water in it. O(N).

    We use CONST to avoid of float computations. It should be power of 2, enough to fill all levels.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it -7 Vote: I do not like it

      Ээх, я не додумался, что через T * CONST можно все к int-ам свести.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I put 1024 water in the first one and used the similar approach that you told. Is there any problem with 1024? Since the first and last glasses of the last(10th) row will receive 1 unit.

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        It should be enough. But you should put T * 1024, not just 1024.

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

          I use double,is my solution wrong?

          • »
            »
            »
            »
            »
            »
            3 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Well it depends how you implemented it. With double and division operation you could get wrong comparisons. With integers it will be always correct :)

            • »
              »
              »
              »
              »
              »
              »
              3 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it
              • »
                »
                »
                »
                »
                »
                »
                »
                3 years ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                and my code accepted :)

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

              For what I know, such dividing by 2 cannot cause precision problems with double (it behaves the same way as bit shift), so it was safe in this task. But its a bad habit for sure, I agree.

        • »
          »
          »
          »
          »
          3 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Ya I meant for each second I passed 1024 units on the first glass and then repeated the process for T time

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Hack testcase of E?

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

    I think K=0.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      i handled it still it got hacked

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        There are still different cases when K = 0. Think about the case where all Ai = 0 but one is '?'

        • »
          »
          »
          »
          »
          3 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          is there any case for K = 0 other than
          * a[0] is already 0 "Yes"
          * a[0] is nonzero but not '?' "No"
          * a[0] is '?' and its human's turn "Yes"
          * a[0] is '?' and its computer's turn "No"
          ?

          • »
            »
            »
            »
            »
            »
            3 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            If all Ai are 0 then it should be "No"

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

              the question says P(x) is divisible by Q(x) if there exists a representation P(x) = B(x)Q(x) . if all A[i]'s are 0 , then if we make B(x) also a polynomial with all coefficient's as 0 , then wouldn't P(x) be a multiple of Q(x) as well?

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    How did you handle overflow? with modulo of some prime?

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      i just took 4 prime modulos

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Share your approach for C. Your code is pretty simple ! @rajat1603

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

          Take the Case when we want every element of the subarray to be equal to a . (For other case just change all a to b and b to a and run the same algorithm again).
          Now consider a to be 0 and b to be 1.
          We want to select the longest subarray with sum ≤ K .
          So we take a right pointer and move it from 1 to N .
          We also maintain a left pointer denoting the left endpoint of the longest subarray ending here. When sum exceeds K , we move the left pointer 1 step ahead.
          So now we have longest subarray with sum ≤ K ending at every index.

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Any fixed prime modulus can be hacked.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Huh! 10 seconds left, i submitted. The result on final page: Pending system testing DAMMMMMMMMMMMN. Now i don't know whether i should be happy or sad in case it passes after i submit later on :\

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I think it will be counted if your submission is in queue before the contests ends

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Now it isn't in my submissions too. Though i got redirected to some link with some token value at the end but probably there was a bit of lag b/w my submission and before server received it. :(

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Is there a nice way to solve E without randomization?

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Gorner's way)

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Gorners?

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

        Other than my reply to your other comment, one more option is to observe that if the absolute value of the partial sum becomes greater than some small value (roughly 10^4 / k-1 or 10^4*n if k is 1) then it's impossible for it to come back to zero. So you can just terminate if that happens, and otherwise proceed as normal, so you'll never get overflow.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

It was a good contest with easy problem, but I could solve only A :D , i couldnt find the formula for B(i think it's something bounded with pascal's triangle ). How you solved B and C ?

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I have three big critiques. Problem C was given before and I could hack it easily. But I didn't. Problem D is awful and easy to come up with a solution. Nobody likes such problems. Problem E is easy.

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

    Ok, so you know that problem C was given before, even though this 5 problems are the first that you solve in Codeforces? Suspicious...

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Illuminati?

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      What I want to say is that the problem is a common use of 2-index technique, I don't mean it was on Codeforces. I don't solve Codeforces, I only solve hard problems and this contest was just to test my level.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I was trying to hack A and I wrote the exact same code of other contestant and tested it on custom invocation. It gave a wrong answer but I got unsuccessful hacking attempt. Anyone knows why?

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

    Sorry, my bad! Everything is ok!

»
3 years ago, # |
  Vote: I like it +12 Vote: I do not like it

I solved D and found contest just finished for a few seconds...

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

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I hope my solution has some bug so that I won't be so sad...

      BTW, D is easy to come up with a solution but not easy to code it, I don't like such problems.

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

        Well, if you are experienced enough, there's nothing to struggle with:

        30 lines of switch-case to rotate a symbol clockwise 20 lines of creating edges to adjacent cells given a symbol 40 lines of bfs + misc to read/write

        In total, not too much if you know what you are doing.

        What I usually do — I just start coding, and quite often it appears that it is not so hard as I expected it to be :)

        • »
          »
          »
          »
          »
          3 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          you are right, I'm not so experienced in program competition. When I write a solution having code above 100 lines, it often contain some bug(maybe stupid typing error like typing i for j ...), I need to do more coding. This is a nice platform :)

        • »
          »
          »
          »
          »
          3 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          You should check some solutions out. E.g. mine uses only 1 line to do rotation and 5 lines to generate neighbors.

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Mine failed, so yeah all cool now :P. 2 silly mistakes. I wrote somewhere 'V' and somewhere as 'v' and other i didn't checked that to go from a to b, a path from b->a and a->b must both exist.

»
3 years ago, # |
  Vote: I like it +19 Vote: I do not like it

Who the hell thought it would be a good idea to put problem D -_- like... What's the purpose of it??
with all due respect to authors

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

    It's a good exercise in implementation.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Well, I kinda don't like it too. Easy algo (just BFS), but requires careful implementation of all cases.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    1. Ways to optimize implementation
    2. Carefulness

    That's the purpose

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    pretty ugly ruined my round because of a silly mistake :/

»
3 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Anyone else got WA'd / TLE'd in D test case 10?

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I got WA too.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Well I did get it, but fixed later. I've used too much memory :)

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Did you use NxM matrix to store distance for each state in shortest path algorithm or NxMx4 matrix? I used both, with NxMx4 i got TLE and NxM got WA :(

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

        In last submission I used NxMx4 matrix of int64 to store distances. Plus one matrix NxMx4 of int8 to store direction flags. Plus three queue's of int32 to queue positions. Around 50 Mb total.

        I used simple BFS.

        Just got it AC after systest, 1500ms and 50Mb.

        • »
          »
          »
          »
          »
          3 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I guess the problem is that i used Dijkstra's then. Never thought about state graph being unweighted

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I don't think the size of the array is the problem. I used 4 * N * M and it was fine.

»
3 years ago, # |
Rev. 5   Vote: I like it 0 Vote: I do not like it

sad...fst 2 problem..

»
3 years ago, # |
  Vote: I like it -6 Vote: I do not like it

Why GlebsHP accepts rounds with such classic problems like those in today's C, D?. I thought the round will be cool because fcspartakm is the problem setter but found only one good problem. :D

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

    Please, wake me up if the problems of Div. 1 contests will become easy and classic for you.

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

      even for a div2 contestant, i spent 3/4 the contest time coding / debugging instead of thinking , i didn't enjoy this contest at all, the only good problem is the E and didn't have time to read it tho

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Just read D and E and the same time. It often happens that one is harder on implementation and the other is harder on the idea.

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

      I'm not saying they were easy or they should be hard. Just saying it'd be better if they were kinda unique.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Just when I saw C has more submissions than B, I knew something was fishy. And it turned out it was similar to Hard Process(ER 11) and Repair road. Problem B was also based on how good you are at google search(But I was unable to solve it :P).

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

    I solved hard process today only :D

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

how to solve pC?
i choose odd ones to connect left even one and right even one.
scan odd ones from left to right
then choose even ones like odd ones
but stuck at pretest 12

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    If we divide the problem in two parts and return the max of both:

    1. Maximum length of substring consisting of a's with at most k changes.
    2. Maximum length of substring consisting of b's with at most k changes.

    After that two pointer approach can be used to solve each subproblem.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Fill consecutive gaps of A OR Fill consecutive gaps of B. Find maximum among both.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      that is what i'm doing
      maybe i make some mistakes

»
3 years ago, # |
Rev. 7   Vote: I like it +43 Vote: I do not like it

In problem E, if you use fixed modulus then you can get hacked. For example, if you use 109 + 7 and 109 + 9 as modulus, write (109 + 7) × (109 + 9) = 1000000016000000063 in base-10000 number system so we get "4 10000\n63\n0\n160\n0\n100" as a hack case.

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

    Now I came to know that my solution will fail in system test!

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone debug this code for D?

My logic should be fine, but I get WA on #10(hate implementations) Logic is to BFS the graph with 4 states for each node(representing number of rotations).

Code

I know, the implementation is pretty messed up, but I did comment a little bit if that helps

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

18085379 Why do I get WA? Anyone care to help me???

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

    Your recursive Fill function does not exit early enough, it continues "pouring" water past the n-th level. Change if (i>9 || j>i) return; to if (i>=n || j>i) return; . Then it passes all tests: 18093994

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can you see the standing without the starred people from div 1?

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

    Just untick show unofficial located on top — right corner of standings page. :)

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
3 years ago, # |
  Vote: I like it -11 Vote: I do not like it

About D: You know what "X" and "Y" usually mean on a 2D grid? You have some idea, right? I can not imagine why the problem statement for D was written with the exact OPPOSITE meaning for those letters. Got WA for this, upsolved after swapping X and Y when reading input. Is Codeforces supposed to be a reading competition?

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

    I agree, a painful mistake. For me it has always been misleading — we store 2D maps and grids as arrays of rows, so if you want to access column X and row Y, you should call Array[Y][X] <-- counterintuitive, isn't it?

    What works for me: just change your perception and think of X as of the first coordinate and of Y as of the second one — then array item access becomes logical — and meets the problem author's expectations.

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

    In my memory in the majority of tasks which has x,y in GRID in statement it is alwasy that X — row, Y — column.

»
3 years ago, # |
  Vote: I like it -15 Vote: I do not like it

When this happens

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

    when I see such large pictures, I shit bricks...

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    feelsbadman :(

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

    You guess that you can change your 'V' into 'v'.I have made a same mistake.

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

      Holy fuck you're right. I have never been so stupid in my life. :/

»
3 years ago, # |
  Vote: I like it +10 Vote: I do not like it

Thanks a lot guys for your efforts and splendid problems :) Oxxxymiron, an awesome start! — looking forward to see your next rounds in future.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Problem C is a bit more sophisticated version of 645C - Enduring Exodus. Same idea, but instead of finding the minimum, you ought to find two maxima and compare them. There is also a possibility of k being 0 in today's one (many solutions got hacked/WA'd because of that).

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Why there are no precision errors for problem B with solutions based on double data type?

For example in my room, 18074368 solution.

Sorry for my poor English.

»
3 years ago, # |
  Vote: I like it +5 Vote: I do not like it

Wow, next contest is also Div.2 Only. And it's only after a whole week.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I find no reason for a Div 2 only round. It simply encourages more fake accounts.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Here's a reason: It takes more time to prepare a Div 1 round.

»
3 years ago, # |
  Vote: I like it +13 Vote: I do not like it

When the ratings are calculated?

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Thank you for posting the Editorials right after the contest. Cheers.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I participated to this contest , but when i go to my profile, my rating is still 0 and the contest it's not showing in the contests tab on my profile. Please help !

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I nearly got my first ever "5 out of 5" on codeforces, and then I fail task B on test 83 ;-(

»
3 years ago, # |
  Vote: I like it +19 Vote: I do not like it

Is it possible to make contests on weekends?

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Test-31 has entry "4 9" and it's expecting 8 as answer. How come it is not 6 instead? At the end of the 9th second, the bottom row only has 0.25 0.75 0.75 0.25!