Блог пользователя SlavicG

Автор SlavicG, история, 3 года назад, По-английски

Hey, hi Codeforces!

It's mesanu, flamestorm and me and we are very excited to invite you to Codeforces Round 871 (Div. 4)! It starts on May/06/2023 17:35 (Moscow time).

We worked swiftly to tailor the problems for this contest, so we hope you will enjoy them! We tried to make the statements short, epic and concise.

The format of the event will be identical to Div. 3 rounds:

  • 5-8 tasks;
  • ICPC rules with a penalty of 10 minutes for an incorrect submission;
  • 12-hour phase of open hacks after the end of the round (hacks do not give additional points)
  • after the end of the open hacking phase, all solutions will be tested on the updated set of tests, and the ratings recalculated
  • by default, only "trusted" participants are shown in the results table (but the rating will be recalculated for all with initial ratings less than 1400 or you are an unrated participant/newcomer).

We urge participants whose rating is 1400+ not to register new accounts for the purpose of narcissism but to take part unofficially. Please do not spoil the contest for the official participants.

Only trusted participants of the fourth division will be included in the official standings table. This is a forced measure for combating unsporting behavior. To qualify as a trusted participant of the fourth division, you must:

  • take part in at least five rated rounds (and solve at least one problem in each of them),
  • do not have a point of 1400 or higher in the rating.

Regardless of whether you are a trusted participant of the fourth division or not, if your rating is less than 1400 (or you are a newcomer/unrated), then the round will be rated for you.

Many thanks to all testers: RedstoneGamer22, tibinyte2006, sandry24, jampm, haochenkang, qwexd, Vladosiya, _Vanilla_, Phantom_Performer, ScarletS, NintsiChkhaidze, keta_tsimakuridze, Dominater069, Gheal, Bakry!

And thanks to Vladosiya for russian statement translations!

We suggest reading all of the problems and hope you will find them interesting!

Good Luck and have fun!!

Are you ready for it?

UPD: Editorial is out!

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

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

As a tester, problems are great!

»
3 года назад, скрыть # |
 
Проголосовать: нравится -17 Проголосовать: не нравится
Click for positive delta
»
3 года назад, скрыть # |
 
Проголосовать: нравится +140 Проголосовать: не нравится

As a tester, I recommend listening to Taylor Swift while participating in this round.

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

queue

»
3 года назад, скрыть # |
 
Проголосовать: нравится -40 Проголосовать: не нравится

so trash contest xD

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

Damn excited for this round. Hope I will become master after this round

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

As a tester, I won't make clickbaiting claims and I won't beg for upvotes.

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

Ya slavicG div4 contest

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

New specialist (including me and 69 others) in div4 comments section,,,

IMG-3731

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

I am really excited to participate in a Div4 contest on my birthday, and also hoping for positive delta!

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

Just +20 to get to pupil. Hope i will do it tomorrow

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

As a tester, this is surprisingly not that bad for a Div. 4

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

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

Praying for +14 delta

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

It's my first "out of competition" contest after a great success on round #870 lol.

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

As usual I liked the cat in Vladosiya's profile.(´◡`)

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

Thanks

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

Are you ready for it?

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

We urge participants whose rating is 1400+ not to register new accounts for the purpose of narcissism but to take part unofficially. Please do not spoil the contest for the official participants.

This part is amazing!)

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

Although I am unrated, I still want to participate. Is there anyone else who feels the same as me?

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

Hello everyone! Have a great round and a good mood.

»
3 года назад, скрыть # |
 
Проголосовать: нравится -32 Проголосовать: не нравится

Queue Forces!!!!

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

Very fast loading and queue for div4! Pretty nice, Good Job Codeforces team!

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

nice Taylor Swift round.

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

Good contest, quit after solving 2 problems.

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

Taylor Swift Round 871!

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

Today's contest was really fun and interesting. Appreciate the problem setters :)

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

Very good problems, especially H. Thanks to the authors for a cool contest.

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

Single people after reading problem A:

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

Любительский разбор всех задач.

Задача A
Задача B
Задача C
Задача D
Задача E
Задача F
Задача G
Задача H
»
3 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve D? used BFS for each N, but got TLE.

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

Short Editorial :

  • A : Iterate over the string and count where the characters differ.
  • B : Count the maximum consecutive zeros in the array.
  • C : The answer is -1 if either of the string value is zero for all n books. Otherwise ans=min(fir+sec,both) where fir-minimum mi with si1=1,sec=minimum mi with si2=1,both=minimum mi with s11=1 and s12=1.
  • D : If m>n, answer is no.we can only divide n if n is a multiple of 3 into pieces n/3 and 2*n/3.Thus, m/n=2^x/3^y where x<=y, iterate for all possible y(3^y<=10^7 , y<=15 ) and find if any integer x satisfies the equation.
  • E : Basic BFS or DFS question.
  • F : From the properties , we can see that m=(y+1)*x,n=1+x*(y+1),find degree of all nodes.Now, x*y nodes will have deg=1,x nodes will have deg=y+1 and 1 node will have deg=x.
  • G : Initialize sum=n*n for each n<=1e6, now take prefix sum of both both type of all diagonals and you have your answer. For example- initially sum[13]=13*13,sum[9]=9*9,sum[8]=8*8,sum[4]=4*4, after taking prefix sum of right to let type of diagonals, sum[13]=13*13+9*9+6*6,sum[9]=9*9+6*6,sum[8]=8*8+5*5+3*3, sum[4]=4*4+2*2+1*1,taking prefix sum of left to right type of diagonals, sum[4]=4*4+2*2+1*1 , sum[8]=8*8+5*5+3*3+sum[4], sum[13]=13*13+9*9+6*6+sum[8].
  • H :Since each qi<=63, AND of any subsequence <=63,Initialise array of size 64 where value of dp[i] is equal to total number of subsequences having AND value i.Now, traverse through the array ,for a value v[i] we take it's AND with all possible values [0,63] and update dp accordingly. Finally, add all dp[i] where number of bits in i is k. See 204835949 for implementation.
  • »
    »
    3 года назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +3 Проголосовать: не нравится

    what would be the actual rating of G and H according to you? I guess something around 1500 for G and maybe 1800 H

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

    In problem F, if the values of both x and y are greater than 1, values of n & m should at least be 7 & 6 respectively, right? But the problem statement says that n can be 2 and m can be 1 [2≤n≤200; 1≤m≤min(1000,n(n−1)2)]...essentially meaning x can be 1 and y can be 0! I'm a bit confused about how to handle such cases of input as my solution got WA.

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

      For an input to be valid, all constraints have to be fulfilled. These are the two different constraints you're thinking about:

      1. $$$2 \le n \le 200$$$; $$$1 \le m \le \min(1000, \frac{n(n−1)}{2})$$$
      2. It is guaranteed that this graph is a snowflake graph for some integers $$$x$$$ and $$$y$$$ both greater than $$$1$$$.

      It doesn't matter that constraint 1 allows cases like $$$n = 2$$$ or $$$m = 1$$$ since these are impossible according to constraint 2. As I said, all constraints have to be met for an input to be valid. Thus, these cases can never appear and you don't need to consider them in your code.

      UPD: The reason you got WA is because there is an edge case you missed. Here is one test case where your code fails:

      Spoiler

      Can you see why this happens?

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

can anyone help me with prove the complexity of my code on D? thanks: https://mirror.codeforces.com/contest/1829/submission/204812242

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

I am very glad that my idea (see https://mirror.codeforces.com/blog/entry/114062#comment-1014185) worked and there was no queue today!

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

In F , according to the constraints , if m = 1 , then how x and y could be both greater than 1 such that x*(y+1) = m = 1 ??

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

    Since inputs are always valid, $$$m$$$ cannot equal 1. Even though the constraint $$$1 \le m \le \min(1000 , \frac{n(n−1)}{2})$$$ allows it, no valid snowflake graph can have only 1 edge. The constraint "It is guaranteed that this graph is a snowflake graph for some integers x and y both greater than 1" "overrides" the fact that $$$m = 1$$$ is allowed by the previous constraint.

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

Solution of A.Love Story — 871A Question with code and explanation of it

https://codeforcer.blogspot.com/2023/05/love%20story.html

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

TAYLOR SWIFT REFFERENCES!? AFTER HER SPEAK NOW TAYLOR’S VERSION ANNOUCEMENT!? I CANNOT-

(sorry for all caps i’m just a big swifty :>)

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

Finally Solved my first dp question in live contest. Despite Div 4, happiness nd motivation bcz of DP is overflowing :)

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

Can somebody explain me why this solution got TLE?

https://mirror.codeforces.com/contest/1829/submission/204844540

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

    You cannot clear the $$$1000 \times 1000$$$ arrays matr or vis completely every time if there are $$$10\ 000$$$ test cases since this would require $$$1000 \cdot 1000 \cdot 10\ 000 = 10^{10}$$$ operations which is not fast enough. Even though memset is fast, it's only a constant factor improvement over manual clearing. You should just clear the arrays manually in the required sections for each test case.

    UPD: You should also increase your arrays matr and vis to $$$1002 \times 1002$$$ from $$$1001 \times 1001$$$ so that you have the exrta "buffer layer" on every side of the used area. 204881319

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

Overall a great round. Well-balanced Problem Set. Although standard ideas were involved, but liked Problems G and H especially. Good educational problems for DP I would say.

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

This was a really nice contest! I particularly enjoyed G and H. (D was also nice.)

I bashed E with DSU ;)

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

Good contest! It makes me know that small mistakes will lead to fatal errors.(In details,I misused variables in for-loops for consecutive 3 problems and wasted plenty of time to fix them....)

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

Finally, solved all.

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

Hint for G. Hits Different ?

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

    Precalculate max(max_i), and min(min_i) values of each row(i). You can calculate Sum(i^2) from i=a to b in O(1). First find row where N is(R). Each row(R, R-1, ... 0) you can calculate start and end numbers of can that falls(Using previous rows start and end number + max_i and min_i). And add SUM(Start, end number) to the answer.

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

E was exactly same as https://leetcode.com/contest/biweekly-contest-103/problems/maximum-number-of-fish-in-a-grid/

If someone copies my code from here is there any chance that my solution can get skipped?

Also this question is from latest biweekly contest on leet code. How can there be soo similar question again on CF.

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

    How would someone would copy your code from there except you? i don't think so your solution will be skipped, coz i also copied my code from old submission

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

    its a very standard problem, and every tester told the same in testing, however apparently, having standard problems in div4 is fine.

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

      and for having those standard problems, beginners can reinforce their newly learnt concepts and algorithms too! so i don't think it's a big deal after all in my opinion

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

        yes, sure, just make those contests unrated then. In my opinion, rated contests should not be having standard problems.

        CSES exists, other tons of archives exists. Beginners can solve standard problems from there. They should not be getting rating for copy pasting codes to standard problems.

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

          if they know all standard problems than they aren't Beginners at all :3

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

            Disagree, a person can know 1000 standard problems and still unable to solve a div2A because they have not seen it before.

            This type of person is what this div4 round encourage :(

            Maybe i am wrong, but most other div4 rounds dont have classical problems atleast in hardest slot, and as mentioned above, E is literally a leetcode problem.

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

              well, with your perspective a lgm can consider a certain problem standard which might still be out of your knowledge, also most of the problem in div2 that they solve might be of some similar concept which they would have already seen in the past, so that doesn't mean the problems like that shouldn't be created just because they felt it quite reused and standard. Hope i was able to say my point clearly

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

                I think there is a big difference in making a standard problem, and having a problem be standard to someone. Today's E and H are examples of the former.

                I cant find any examples of the former in recent div2 rounds, even if they need standard knowledge, they are not just that. You need to make some observations after that. Perhaps you can enlighten me to some problems i missed which are completely standard in div2(in recent times and preferably one of the easier ones not F or smth)

                As for the lgm point, yes there are definitely such problems which an lgm would find standard and i still cant solve. I dont see whats wrong with that. The lgm(hopefully) and me would oppose putting such problems in a div1 round.

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

          yeahh, actually i agree with you on that. overall i do think the later problems in the contest are less dificult compared to the other div 4s. nevertheless, the problems are still interesting and the contest is one of my favorites so far!!! :>

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

            Its not about the difficulty. A slightly easier contest is fine. One cannot always have the correct difficulty.

            However, i think all rated rounds should have original problems. bad problems are better than unoriginal ones.

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

I am curious, was the theme determined after the announcement of her new album or are they unrelated?

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

This contest has given me a very big motivation ( and hopefully a very big rating :) ). Thank you for the creators of this contest, I really liked problems, especially the problem H.

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

The contest was great

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

Cool contest, last 3 problems were interesting and at a good difficulty level for myself.

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

First time I can solve a graph problem (1829F - Forever Winter) ^_^

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

Is it legal for two or more people to participate using the same account?

I think this account c0nf11c7 is being used by two or more people in this contest.

Here are the clues that lead me to believe this:

  1. Some of the code has strange symbols, while other code does not.
    This is unusual, as we usually use the same template during the contest.

  2. There is only an 11-second gap between problem C and H, and the templates of them are different.
    C: https://mirror.codeforces.com/contest/1829/submission/204766645
    H: https://mirror.codeforces.com/contest/1829/submission/204767094

If this is indeed cheating, please take action as soon as possible.

MikeMirzayanov should look for this.

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

Best Contest of my life

Thank you all

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

if i hack some people i'll gain extra elo ?

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

Hello, CF why I it give me TLE here 204890621 I replace if (n%3!=0) by if(n/3*2!=n-n/3)

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

hello everyone, first of all I am sorry for bad English. Can someone tell me about the best place where I can reed about theories in c++?

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

Video Solution Of All Problems.

Link : https://youtu.be/axLtBF-td3o

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

Nice contest, btw in case someone is interested: This is a similar problem to C

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

a good day to be a swiftie on codeforces

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

https://mirror.codeforces.com/contest/1829/submission/204906135 https://mirror.codeforces.com/contest/1829/submission/204781971

I have viewed the hack log and wonder why some people wrote these code that looks like a backdoor.

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

When will I gain a rate?

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

Failed system test on D :( My submission

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

This was my second contest, My rating after first contest(which was of div2) was 548. Still this round was unrated for me, why? Can anyone plz tell me, I am new to this site.

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

I am a newbie with ~600 rating, then why is this contest showing to be unrated in my contest section!

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

Great problems! Problem F is really impressive!

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

Expected to cross newbie level with this contest, but fine, it was a great contest with interesting problems

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

Swifties round :)

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

Can anyone tell me why I got -40 even though I solved A and B ?

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

Nice probelems

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

I tried solving G with DP, but it is even failing on the first test case:

Spoiler

P.S: I'm sorry about the bad format of the code, I don't know how to make it look good.