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

Автор gyh20, история, 5 лет назад, По-английски

Hello Codeforces!

feecIe6418 and I are glad to invite you to Codeforces Round 729 (Div. 2) which will start on Jul/03/2021 16:05 (Moscow time). Note the unusual start time of the round.

The contest will last for two hours, and you will have five tasks to solve. The tasks are prepared by feecIe6418 and me. This round is rated for participants whose rating is not higher than 2099.

We would like to thank:

It's the second time we hold our contest, our previous round Codeforces Round 670 (Div. 2).

We tried our best to make the statements short and clear, pretests strong and problems interesting. We hope you like the problems!

Score distribution will be announced shortly before the round.

Score distribution: 500-1250-1500-2000-(2000+1000)

Editorial is published Editorial

Congratulation to the winners:

Div1+Div2:

1.Nilou_

2.244mhq

3.jiangly

4.Benaive

5.Ormlis

Div2:

1.Nilou_

2.Benaive

3.hehezhouyyds

4.TuNormie04

5.SoilCrystal

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

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

If you are nerd who is on cf all day, lets be thankful for the resources we have ! Quick question : How ? Ez, just participate and enjoy this great round ! Wish you enjoyable contest :)

Also, as a person involved in testing, I can assure that problems are interesting with statement being kept short and crisp. Make sure you register :)

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

Now I really have to say problem B was really harder than A :(

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

Nice start time for Chinese! Wish I can be purple in this round :).

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +336 Проголосовать: не нравится
Ah Shit, Here We Go Again
»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

hoping not too difficult.hoping getting high score

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

I loved this, Thank You!

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

you will have five tasks to solve

Neither problems nor questions, tasks seems good.

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

I appreciate this.

Spoiler

Hope i am able to solve B.

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

Chinese Round! But it's sad that I couldn't participate in it because of my courses TAT

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +105 Проголосовать: не нравится
As a tester, I'd like to say:
»
5 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

Was waiting for this contest eagerly to come back to expert

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

Chinese round means get ready for FSTs.

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

A lot of testers!!!,I am afraid of paper leak.:) kidding never mind

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

Yet another codeforces contest, Yet another unusual timing contest

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

As not a tester I'm waiting really good contest with brilliant problems.

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

Wow, another Chinese round and friendly time for Chinese! I'm looking forward to problems written by feecIe6418!

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

Note the unusual start time!

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

2 hours and 5 problems ? My rating is expected to have a negative expectation value.

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

cf1

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

The best thing is the honesty between the programmers!

RESPECT!

d701bd3c2f75588c6d07b7238555c7d9

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

5 problem contest means C will be a good problem to solve.That means people will not get away with speed solving + short statements(My advantage as I am a big fan of AtCoder type problems).Can't wait for this contest to start.

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

Nice start time (for UEFA Euro :) )

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

I love codeforces!

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

Hope to have a good experience.

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

At your last round, I became master for the first time. I hope I will become again tomorrow.

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

Strange 38 Comments Done but Nowhere I can See 1-Gon.

PS: Not Tagging him he might be busy it seems :-)

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

yes, with this time frame I can participate without worrying about missing EURO.

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

Hope to become expert this round!

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

I hope I will raise my rating in this contest))))))))

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

I hope to become a specialist after this round

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

My comments getting contribution after having been removed completely baffles me...

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

Cool, good start time, I think this will be my first contest, I hope I enjoy it as much as all of you.

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

Is this rated contest?

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

Yeah! Finally a contest after a long break. :)

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

We hope the problems be interesting and balanced

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

starting my cf journey with this contest wish me luck

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

Note the unusual start time of the round.

Well, for the Euro cup, actually :>

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

Yuhao Guo is a genius prob. setter! orz

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

Looks like I am not the only one who gets distracted and uses o instead of i with that scire distribution.

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

Scire distribution.

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

Does (2000+1000) mean that E2 will be as easy as 1000?

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

What is (2000+1000) difficulty? Not the same as 3000?

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

how to become cm ?

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

Coming back to participate after 5 July'19.

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

Hope my ratings increase this time.

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

Mathforces.

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

    It actually does not feel like a coding competion at all. I mean, the term "coding competion" somehow implies that the problems should be solveable using codings skills.

    With todays problems coding skills are not relevant.

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

      Don't be salty, just work on your math skills and you'll do better next time :)

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

        It is more likly I quit.

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

          They are relevant — go take edu rounds. Other problem setters will always be a hit or miss. I know personally, I will never take an Omkar round because I will never succeed in those math-y rounds, and the problems are often severely underrated in my opinion (how was Diluc 1500?)

          I think also, for someone with your experience, you should know this already.

          Your point that "coding competion somehow implies that the problems should be solveable using codings skills" is nonsense. That's like saying "physics competition somehow implies that problems should be plug and chug formulas". Get over it, physics competitions have been about manipulating algebra >10 years ago.

          I agree, math is hard. If you want to quit, go ahead. But complaining about CP in general is your own opinion and projecting it on others is lame.

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

        Why just math? We can hone our physics and chemistry skills and have corresponding rounds here.

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

          Those are empirical sciences, it's not at all the same.

          You can solve all of today's A-C without any special knowledge or tricks, you just need to look at some examples and find a pattern.

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

Problems in the contest are complete shit and very commonplace and ugly.

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

the greatest contest i have seen.

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

anyone else buckling up for a FST on B ?

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

Problems were nice but giving 3 problems purely based on maths is not a good idea. Many people can only solve top 3 problems and if all the top 3 problems are based on maths than how can people enjoy the round?.

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

I have seen CP contests for Russian school students. This feels like Russian Mathematics Exam for class 8 or whatever.

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

contestants eagerly waiting for the next cf round.... Chineese question setters!!! Take this maths test

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

someone plzz kill me i took 7 attempts and more than 1 hr to find out that my first submission's logic was correct on problem B but getting wrong answer due to overflow :(

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

are these the good ideas they were talking about... looolllll

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

And, problemsetters, please consider that these "tell me the formular" problems are very cheater friendly.

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

MATHFORCES

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

Found this research paper from which C appears to have been lifted directly (?). Still can't comprehend, too tough this. Feeling dumb AF

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

"Coding requires good amount of math"

...and we took that personally! ~ today's contest setters

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

MEET AN EXPRIENCED & SHAMELESS CHEATER This is how Master_Jiraya bypasses Plagiarism testing.

i reported to codeforces and MikeMirzayanov about him from past 4 contest and he does cheating in it also and got plagiarism , thanks to u for upvote my comment so that he got punished . and today again he cheated in the contest , pls again upvote my comment ......

Master_Jiraya does cheating from starting and i reported about it to MikeMirzayanov and he got plag in last 3 rounds , he abused me in private chat becz i reported him https://ibb.co/JmhSwKL . guys show your support and again upvote my comment so he again got punished.

People like Master_Jiraya are spoiling the sport. I don't understand where would cheating take them in life. They will never get anywhere in life but always remain what they are i.e cheater. He should be banned from the platform as soon as possible . MikeMirzayanov sir pls ban him and skip his solutions .

his todays contest submission 121219128 121218241 , saw his submission timing , he submitted 2 solutions within 2 minutes , tourist your new competition ,lol and also see this dummy variables snippet to bypass the plagarism . ban this Master_Jiraya , i urges the admin of contest to help me to skip his submissions gyh20 feecIe6418

FOR(i,0,ttt){ int tmp=xx[3]; xx[3]=xx[5]; xx[5]=tmp; xx[1]++;}FOR(i,0,ttt){ int tmp=xx[3]; xx[3]=xx[5]; xx[5]=tmp; xx[1]++;}FOR(i,0,ttt){ int tmp=xx[3]; xx[3]=xx[5]; xx[5]=tmp; xx[1]++;}FOR(i,0,ttt){ int tmp=xx[3]; xx[3]=xx[5]; xx[5]=tmp; xx[1]++;}

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

How come 2900 people solve C??!!

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

How to solve B? I know it would be some trivial shit >_<

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

MATHSFORCES

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

I declare problem D unsolvable. This won't change even if I am presented with a solution.

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

    Would you read it?

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

    I came up with an approach which I could not fully execute because I was running low on time, but here's my idea if anyone is willing to try it out.

    Instead of trying out every single subset, let's just consider the probability of a number being included in the final result and then add $$$P(i) \cdot Total \cdot val[i]$$$ to the result, where $$$P(i)$$$ is the probability of its presence, $$$Total$$$ is the number of subsets and $$$val[i]$$$ is the value at given place in initial array.

    By doing some DP with two states, in $$$O(N^3)$$$ we can determine the probability of $$$k$$$ lower numbers being present in the final multiset, for each $$$0 \leq k \lt N$$$. Could someone let me know if this approach would work?

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

    My idea was: for each + x count how many subsequences up to index i have x in the kth position. But I ran out of time working out / implementing the DP.

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

Great problems! I really enjoyed this contest. Maybe a bit math-heavy, but I like that.

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

Problem B Had me :)

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

math & dp round:(

$$$10^9+7,998244353,mod,mod$$$

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

L.O.L problem D with repeated value is kind of hard to understand, can anyone show me how to deal with this situation? (sorry for my bad en).

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

Great contest! Thank you feecIe6418 gyh20.

Did you like the questions too?

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

I regret giving this contest :)

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

International Codeforces Maths Olympiad !!!!!

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

I hope the person who set limits for E stubs his toe.

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

Was D a dp problem? I could not figure out the states for like an hour and half :(

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

    I came up with something but was struck at a point if we maintain for every index the minimums possible with their count we can add that to the answer in case of '+' case. But I am struck with the '-' case, we can only track the minimums, but in '-' case we have to expose the second minimum, but I don't have track of that :(

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

    I did Problem D it with dp.

    I mark - with -1 and + x with x in an array. We chose one position check with num[check]!=-1 which we are going to check now: what will be the final contribution of only this number to the answer. We replace all other numbers in the array. If the number is less than num[check] we replace it with S. If the number is more than num[check] we replace it with G. It it is same as num[check] we replace it with S if it is before check and with G if it is after check.

    Now we start a 2D-dp dp[pos][S]. We will check the positions from left to right and the dp counts for position pos how many S we still have, S beingt the amount of numbers smaller than num[check]. num[check] itself also gets added to S at position check. If we passed position check then all num[pos>check][0] are set to 0, because we lost our num[check], it can't contribute anymore.

    In the end we sum all dp[n][S] over S and multiply it with num[check]. Repeat for all positions check and we got our answer.

    My submission: 121349216

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

    Yes, it is. Let C[i][j][k] be the number of subsequences of S up to index i such that the jth value is/would be the k-th highest element in the multiset. Then the answer is the sum of S[j] * C[n][j][k] for all j and k.

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

how to solve problem B ?

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

A, B & C are solved in less than half an hour and only 3 problems are solved in 2 hours :(

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

This is not a contest for begineer.

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

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

What was that C ? I came up with a lot of stuff but all led to inclusion exclusion which I am very weak at. This round made me love and hate math.

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

    $$$f(i) = x$$$ means that $$$i$$$ is divisble by $$$(x-1)!$$$ and not divisible by $$$x$$$. let $$$ans_i = n/lcm(1, 2, ..., i)$$$, start from end and subtract $$$ans_j$$$ from $$$ans_i$$$ where $$$(i \lt j)$$$ and add $$$ans_i * (i+1)$$$ to the answer.

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

how to solve C?

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

    If you plot out the first few terms of $$$f(k)$$$, you notice that the sequence is "almost" periodic:

    $$$\mathbf{2}, \mathbf{3}, 2, 3, 2, \mathbf{4}, 2, 3, 2, 3, 2, \mathbf{5}, \ldots $$$

    The changes to the pattern are at certain threshold indices $$$t_k = 1, 2, 6, 12, 60, \ldots $$$. These are precisely the values $$$\text{lcm}(1, 2, \ldots, k)$$$ where value $$$k$$$ appears for the first time.

    Let $$$r_k = t_k / t_{k-1}$$$ and $$$g(n) = \sum_{k=1}^{n}{f(k)}$$$. Then we can use the pattern we noticed to compute the sums for each threshold:

    $$$g(t_k) = r_k \cdot g(t_{k-1}) + f(t_k) - f(t_{k-1})$$$

    In other words, the sequence up to $t_{k-1}$ repeats itself $$$r_k$$$ times up to $$$t_k$$$, except $$$f(t_k)$$$ is different.

    Suppose $$$t_k \lt n \lt t_{k+1}$$$. Then we can observe that:

    $$$g(n) = g(t_k) + g(n - t_k)$$$

    Using these two formulas we can efficiently compute $g(n)$ for any $$$n$$$.

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

      Ok, how do people solve it in 3 (or even 10) minutes though?

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

        If I knew that, I'd have a higher rating. :) It took me about 30 minutes with the above approach. I can see that Um_nik found a brilliant solution which is way simpler to implement.

        Suppose $$$f(n) = i$$$. Then we know that $$$n$$$ is a multiple of $$$t_k = \text{lcm}(1, ..., k)$$$ for all $$$0 \le k \lt i$$$ (letting $$$t_0 = 1$$$). In fact, we can express $$$f(n)$$$ as the count of these divisors $$$t_k$$$:

        $$$f(n) = \sum_{k : t_k \mid n}{1}$$$

        So to compute $g(n)$, we can just count up the multiples of $$$t_0, t_1, t_2, \ldots$$$ up to $$$n$$$. This can be expressed as:

        $$$g(n) = \sum_{k : t_k \le n}{\left\lfloor{\frac{n}{t_k}}\right\rfloor}$$$
»
5 лет назад, скрыть # |
 
Проголосовать: нравится +121 Проголосовать: не нравится

I love how they used A to lure participants XD

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

How to solve C ? I found this on OEIS but not able to solve it. Thanks.

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

    let us now consider the number i. then those numbers that are not divisible by all numbers from 1 to i are divided by their lcm. we can calculate how much before this number i was divided by all the numbers from 1 to (i-1). let it be X(n/lcm(1...i-1). We also know how many numbers are divisible by all numbers from 1 to i (n/lcm(1...i)) = Y. then the number of numbers with i = the minimum divisor = Y-X

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

I don't know why I am getting TLE in question B.

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

CountingForces

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

problems were more like trashes ! it took away all the fun during contest ! what's the point to arrange a online contest based on these trashes ?

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

First 15 mins submissions account to 55% of total submissions. Difficulty transition from B to C was high enough.

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

Out of curiosity: why do most people dislike mathforces?

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

    Because it's hit or miss for many people.

    For example,
    1. In B, I failed to observe that a^n(a^m(1+k*b)+l*b) is actually in the form a^p + q*b.
    2. In C, I failed to observe that multiples of lcm(1..x) can give result for x+1.

    Any tips regarding how to not miss these observations?

    • »
      »
      »
      5 лет назад, скрыть # ^ |
       
      Проголосовать: нравится +41 Проголосовать: не нравится
      1. Factor out $$$a$$$ or $$$b$$$ / manipulate the expression. The final expression should be as simple as possible.
      2. "Contribution to the answer": how many times does $$$x$$$ appear in the sum?

      Btw I think that most greedy observations are more "hit and miss" than mathforces.

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

        Regarding 2, I thought along that line but couldn't come to the conclusion that lcm could be used. I was actually thinking with inclusion-exclusion principle for some reason. :(

        Yeah, greedy observations (especially game theory based) are the most difficult for me at least.

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

      for C I don't think such observation is needed. I just observed that product of $$$1^{st}\,\,14$$$ primes is greater than $$$10^{16}$$$. So I wrote a brute force solution with time complexity $$$O(14*log(10^{16}))$$$. One more trivial observation will be if $$$f(i)=x$$$ then $$$x=p^k,\,k \gt 0$$$ otherwise if $$$x=p^{k1}q^{k2}$$$ then we can always find some $$$j \lt k1$$$ or $$$k2$$$ such that $$$p^j$$$ or $$$q^j$$$ does not divide $$$i$$$. . Now you have to just implement it. You can see my submission if you want it should be understandable.

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


 i couldn't get the modulo correct, help guys,

 for 10000000000000000, i am getting 807500006, while the answer is 366580019.





 ll x = n/6;

 ll ans = 0;

 if(x > 0) ans = (ans + ((x%MOD * 12%MOD)%MOD))%MOD;

 if(x > 0) {
    if(x%2) {
       ans = (ans + (((x/2)+1) * 4));
       ans = (ans + (x/2) * 5);   
    }   

    else {
          ans = (ans + ((x/2)*4));
          ans = (ans + ((x/2)*5));
    }
 }

 if(n%6 == 1) ans = (ans%MOD + 2)%MOD;
 else if(n%6 == 2) ans = (ans%MOD + 5)%MOD;
 else if(n%6 == 3) ans = (ans%MOD + 7)%MOD;
 else if(n%6 == 4) ans = (ans%MOD + 10)%MOD;
 else if(n%6 == 5) ans = (ans%MOD + 12)%MOD;

 cout << (ans%MOD)%MOD << "\n";
»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

The first half of the contest certainly required some mathematical maturity, but solving C was quite rewarding. I liked all the problems individually, but found it a strange choice to put B + C on the same contest and D + E on the same contest. Thank you for writing!

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

I thought that actual programming is done on CODEforces, seems like I am mistaken. My bad.

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

Why does my code TLE? I tried to cover all the corner cases...

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

Please Correct me if I am Wrong -:

Approach -:

f(odd number) = 2; f(even number except multiple of 6) = 3; f(odd multiple of 6) = 4; f(even multiple of 6) = 5;

Now just check how many EVENs, ODDs, ODD Multiples of 6 & EVEN Multiple of 6 are there in n & simply add f() of all of them.

I was getting right answers for first five test cases, couldn't get through the modulo one T-T

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

ProblemSolvingForces. Please, we need problems where you need to write segment tree and get ac, because calculating lcm and calculating answer modulo 998244353 is too hard and you can't solve problems like that if you didn't spend 20 years learning math.

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

Thank Writers and RIP for my rating.

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

In problem E (both E1 and E2), why were there almost no cases in which $$$mod$$$ is small? There should have been some cases that have $$$mod=10$$$, for example.

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

Imagine getting 3.935sec/4.000sec on the pre-test, and having to look at "Running Test 63", "Running Test 64", ... one by one after that. MY HEART, oh my god. Untitled

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

could anyone please help me in figuring out the mistakes that I have done in building the logic of problem C, it would be a great help if anyone helps me through this. Thanks in advance! Here is my code (https://pastebin.ubuntu.com/p/vXc24T32Sh/)

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

I'm sorry, but this is not the kind of contest many people like..

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

Stop saying that the problems weren't good.Problems were really good.You are reluctant solve div-2 A B C level math problems.Come on bro!!!.Without skills in maths, you won't go a long way.in cp

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

    Tbh, this has nothing to do with how good your math level is. It's all based on: do you see it. I figured out how to do ab and c, but only because I was lucky I saw it, not because I have math skills.

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

      bro it's combination of cp and math skills.Practice in cp enables you to 'see' it.For example, in B n was in some form a^x+by...and your math skills enable you to check it.You shouldn't blame the problem setters for making this sort of problem

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

        I agree that math is indeed needed, but you can't say this is a programming contest. It felt like a math olympiad. Tell me, where are the problems where you needed data structures, algorithms, ..

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

          Codeforces certainly doesn't give math problems only in every contest.One or two contests like this is ok.And if it felt like math olympiad to you, then what would you call atcoder? Mathcoder??

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

            The last 4 contests I did contained a lot of math problems. I would be better if there were 1 math problem in this contest in the next 5 contests, instead of just putting them together.

            You also said something about atcoder, but I've never done a contest there.

            And if there are people who like these kind of contests, which I have totally no problem with, but please do it somewhere else or announce it beforehand. When people want to do a contest at Codeforces, they most likely want a contest where there will be graphs, dp,.. and most importantly: multiple solutions. Don't tell me there are many approaches for problems like these..

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

              You also said something about atcoder, but I've never done a contest there.

              AtCoder is a nice platform and their beginner contests are good for beginners. Exactly because they are easier than codeforces Div.2 and you will be almost guaranteed to solve multiple problems during a contest. Here's an announcement of their tomorrow's contest: https://codeforces.me/blog/entry/92484

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

    Stop saying that the problems weren't good.Problems were really good.

    The biggest downside of this contest was that places between 4685 and 14370 had been decided by just speed-solving a single problem A (even before cheaters removal). And this alone is very weird. The problem setters may have miscalculated something, unless the plan was to unleash their good problems on good-for-nothing audience.

    You are reluctant solve div-2 A B C level math problems.Come on bro!!!.Without skills in maths, you won't go a long way.in cp

    You did well in this contest. Congrats! But there's no need mocking the others. Hopefully the others learned from their mistakes and will show better results next time.

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

Thanks,for an amazing round!!

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

Finally back to blue

It felt like I didn't deserve to post messages for the last week and now I can post again

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

To not keep you waiting, the ratings updated preliminarily. We will remove cheaters and update the ratings again soon!

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

Although the problems A, B, C were straight up math, in the end I reached purple for the first time, so tianbu orz, gyh20 orz

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

Curious as to why only a single sample was given in E. This is probably just me whining, but it could've been helpful for debugging such a bug prone problem where I can't figure out if it's a mod issue or not. I know a brute for small n takes < 5 mins to write. But those spare minutes often make the difference.

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

Felt like i was giving a Maths Contest, rather than a Programming contest.

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

I hope they post the editorial soon. Early editorials are good because you still have interest in the problems immediately after the contest and that's usually not the case with late editorials

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

too mathy. Bad contest/coordination.

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

In problem B, I used two approaches. One with a for loop and one with a while loop. The while loop solution got a TLE whereas the for loop one got accepted. Why might this be happening?

Solution 1 (while loop) : 121246493 Solution 2 (for loop) : 121249628

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

Sorry if you find the round unbalanced, we will try to make it better next time(hopefully if there will be a next time).

But here's something I want to say

I personally am not a fan of math problems(in fact I like data structures and graph theory and greedy MUCH better), and I dislike math just like many of you do.

But I wouldn't say that the problems are bad simply because they are mathy, and problem E is counting which is not particularly math, you don't need to study MO for any of these problems.

Math is a type of competitive programming, which is important for any of us to learn. You can't just judge a problem by it's type, feecIe6418 really spent his efforts when preparing the problems, you can see that every problem involves something different and something new. You don't need high leveled math, just simple math learned in middle school.

I dislike math, no matter in the past or now. Before, I considered mathy rounds as bad rounds, but I gradually understood that I didn't find the problems interesting because I didn't put myself into it. You can find something new in different problems. It doesn't matter whether it's math or not, but its quality does matter. It would have been really easier if I just simply copy a data structure problem and add some queries or change a little, or I can just join two well-known idea and make a new problem,or simply copy some problems from MO and make a constructive problem, these things are much easier than creating a "math" problem .

Don't say a problem is all about math if you find $$$mod$$$ numbers in it. Problems on counting usually focus on finding a suitable DP state or find another way to cauculate, And the problems aren't necessarily needed to be solved with polynomial technology.

We discussed the problems over and over to avoid using some well-known solutions or problems too standard. Though I don't like math and I'm not good at math, but I wouldn't call a problem "trash" if it is simply because it is a problem about math.

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

Video Explanation for Problem A and B :

Problem A: https://www.youtube.com/watch?v=tWEbqar5tCA

Problem B: https://www.youtube.com/watch?v=zun-Wbr4rWk

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

Can any body tell what is wrong with this solution for problem b 121252891?

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

For C, you don't need to use the inclusion-exclusion principle in a complicated way because the sequences of multiples of lcm(1, 2, ..., i) are subsequences of one another. You can just update by the difference of the 'lowest non-divisors'. For example there are floor(n/2) terms with f(i)>=3, floor(n/6) terms with f(i)>=4, floor(n/12) terms with f(i)>=5, floor(n/60) terms with f(i) >= 7... So to count them all: 3*floor(n/2) + (4-3)*floor(n/6) + (5-4)*floor(n/12) + (7-5)*floor(n/60) ... (here if (newQ-q)*floor(n/div), start with q=3, div=2 then div = lcm(div, q)(=q*div/gcd(q, div)); q += 1 (keep incrementing if q divides div). That's for the even terms, the odd ones are just 2.

Hopefully this makes sense.

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

can someone tell me why in codeforces round 729 question B giving wrong answer if i write if"(n%b==1)" it gives wrong submission but for "if((n-1)%b==0)" it gives correct submission. question link-https://codeforces.me/contest/1542/problem/B

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

Unfortunately, I only finished implementing E2 after the contest :(. Oh well, here's my solution:

Consider two different permutations $$$p, q$$$ of length $$$n$$$, and say that they match on the first $$$n - i$$$ numbers for some $$$i\in [0, n - 1]$$$, and differ on the $$$n - i + 1$$$th number. WLOG $$$p$$$ is lexographically smaller than $$$q$$$. Let $$$S$$$ consist of the set of numbers in the last $$$i$$$ numbers of $$$p, q$$$, which clearly are identical. Then the difference in the number of inversions in $$$p, q$$$ only depends on the difference of the number of inversions in the last $$$i$$$ numbers of $$$p, q$$$. Say that the $$$n - i + 1$$$th number of $$$p, q$$$ are $$$j$$$th and $$$k$$$th largest elements of $$$S$$$ respectively, where we must have $$$j \lt k$$$. Let the last $$$i - 1$$$ elements of $$$p$$$ have $$$ij$$$ inversions and the last $$$i - 1$$$ elements of $$$q$$$ have $$$ik$$$ inversions. Then the difference in the number of inversions of $$$p$$$ and $$$q$$$ is simply $$$(j + ij) - (k + ik)$$$, and we simply need that $$$ij - ik \geq k - j + 1$$$.

Thus if we do casework on $$$i, j, k$$$, we simply need to find $$$f[i - 1][k - j + 1]$$$, the number of pairs of permutations such that they have length $$$i - 1$$$ and inversion counts differing by at least $$$k - j + 1$$$. We can iteratively build each array $$$f[i]$$$ from $$$f[i - 1]$$$ by doing casework on the newly added element in the permutations along with some simple math calculations and prefix sums. Then this overall works in $$$\mathcal O(N^3)$$$ since there are $$$\mathcal O(N^2)$$$ inversions. Note that I shift my indexing by a value $$$I$$$ so that negative indices are handled more easily.

My submission is linked here for more details. I used the solve function to calculate the number of permutations of length $$$n$$$ with exactly $$$k$$$ inversions, but it is only used for $$$n = 3$$$ as a base case, so it's not needed.

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

When will you put the editorial link ?

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

I have a solution for C without LCM, but I don't know why it gets WA on n = 1e16. I tested it with every n < 100 and it works. Can you find a mistake here?

Solution: find all the smallest numbers whos divides by the sequence of first numbers (will call them super numbers):

1 (div by 1)
2 (div by 1 and 2)
6 (div by 1, 2 and 3)
12 (div by 1, 2, 3 and 4)
60 (div by 1, 2, 3, 4 and 5)
...
*the biggest super number below n*

Then, we start choosing numbers step by step starting from the max to min. We divide n by our super number, subtract with the amount of this operation on the previous step, and then multiply this number with the first non-divide number.

j = min_dev.back();  // for 60 this is 7, for 12 is 5, for 6 is 4 etc
int x = n / values.back() - last;
out += x * j % mod;
last = n / values.back();  // values here exactly our _super numbers_ (1, 2, 6, 12, 60, 120...)

All code here: https://codeforces.me/contest/1542/submission/121259996

I had been debugging this code for the last hour of the contest, but haven't found any error.

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

This code for problem D in Java gets a TLE verdict.

java

While this direct translation to C++ gets AC with time to spare.

cpp

Does anyone know a way to optimize the Java code? or should I just take this as yet another sign to switch to C++?

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

Before editorial comes out, you can find solutions here: https://www.youtube.com/watch?v=QbRMPoFpDmg&ab_channel=ColinGalen

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

Will there be Chinese editorials?

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

Nice start time for Chinese! But prblem C is really harder than B.

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

Could anyone tell me the solution of Problem D? I'll appreciate it if you can give me some hints.

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

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

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

Problem A Why this code showing me WA? https://codeforces.me/contest/1542/submission/121273828

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

Bye bye Expert :(

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

mathforces :(

The difficulty gap between A and B and the one between C and D are quite large :(

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

Guys, what were the difficulty levels of the problems B and C in your opinions?

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

in the C Tutorial : "Since f(n)= i means lcm(1,2,...,i−1) ≤n " why? I don't understand this, can you explain it to me?

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

Anyone can help explain why ans for Div2 E2 with n=5 is 904 rather than 819?

It seems that I somehow misunderstood the description, but idk how...

A simple py program that outputs 819 for n=5:

from itertools import permutations

def invnum(p):
    ans=0
    for i in range(len(p)):
        for j in range(i+1,len(p)):
            if i<j and p[i]>p[j]:
                ans=ans+1
    return ans

def check(p, q):
    if p[0]>=q[0]:
        return False
    return invnum(p)>invnum(q)

cnt=0
l = list(permutations(range(1, 6)))
for p in l:
    for q in l:
        if check(p,q):
            cnt+=1
            #print("p=",p,' q=',q)
print(cnt)

Update: nvm, i thought the 'lexicographically smaller' do not include cases when p1=q1, because I didn't see these cases in the example with n=4.

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