Pa_sha's blog

By Pa_sha, history, 3 months ago, In English

Hello Codeforces!

I am pleased to invite you all to participate in Codeforces Round 970 (Div. 3), which will start on Sep/01/2024 17:35 (Moscow time).

The format of the event will be like any Div. 3 rounds:

  • 6-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.

I encourage participants with a rating of 1600+ not to create new accounts but to participate unofficially.

Only trusted participants of the third 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 third 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 1900 or higher in the rating.

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

Also, it will be the first round with unrated register. If you already registered as rated participant you can change registration type here.

I would like to thank

Good luck!

UPD:

Editorial has been published.

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

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

Good luck to everyone! How were you able to set a round as a specialist though?

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

as a tester give me contribution

»
3 months ago, # |
  Vote: I like it -69 Vote: I do not like it

As a tester, I cried because how beautiful the problems are

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

Unrated registration! Too bad I can't test that when I'm usually a rated participant! (since I'm >=1600)

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

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

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

    yep, i want it, because i haven't participated in 5 rating contests

»
3 months ago, # |
  Vote: I like it -23 Vote: I do not like it

qp

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

Will not be able to give this contest :( as I have to travel to college tomorrow at same time.

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

will unrated participants know what their rating changes supposed to be?

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

my first unrated div3 :O

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

I have a question — youre only a specialist but you are able to make a content. I have heard that you have to be a master to be able to do that. Can someone explain?

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

    You have to be master or a writer in the past, as blog with rules say

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

As a tester, the problems were great! GL everyone

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

as a tester I hope that yall have fun in this contest!

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

experts who registered as specialists wya

darn they put me out of competition

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

I once again hope I can AK this round ^_^. Good luck to you all as well!

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

Interesting fact, this round is rated for the author. As a tester, I encourage him to participate and get $$$\infty$$$ delta.

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

    Why the author participant the contest? It's unfair for us, and it's the same as cheating. I can't reach 4000 rating all because of you.

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

      You're not the only one who wants to reach $$$\color{red}{4}\color{black}{000}$$$ rating. After tourist've gotten a new rank, everyone does their best.

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

Will we have more unrated registered rounds?

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

    Yes, mike said we will apply this innovation for ICPC-like rounds (Div. 4 Rounds, Div. 3 Rounds, Educational Rounds). After we have tested the feature in ICPC-like rounds, we will start using it in other types of rounds as well.

    You can checkout the blog here

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

I will become the second person to reach 4000 rating and reach Tourist in this contest

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

    Good , But It doesn't matter, until You are enjoying it. Hope you become oneday.But Still you are our friend.

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

Return expert?

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

Going to attempt my first contest any suggestions.

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

    Learn from my mistakes.Think before you write your code

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

I'm back

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

First time participating unofficially, hope the problems will be good, and good luck to other contestants! ^^

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

Good luck everyone !!! I will be gray forever huhu

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

Oh god give me power to solve atleast 2 + questions this time :) I love you all who ever reading it

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

Good luck and have fun! I am goona up to pupil

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

i hope i dont drop to newbiew

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

I am very much excited for today's contest, but as usual, more than 2000 cheaters are also ready

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

I am hoping for a positive delta and changing the color of my username

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

This Div3G is like div4D lol

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

Don't just change the problem statement mid contest,who tested this?

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

Are points reduced for compilation error also on submission. I forgot to select the correct language before uploading in 2 questions. :(

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

    no reduction in points in error/wrong in 1st testcase

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

Problem F really made me angry thought about it over and over again with no conclusion, the third testcase did not make sense and I just can't think straight anymore from the anger I had of this failure. is the modulo increasing the result somehow? I just don't remember modulo could do something like this, am i missing something about probability? wish I started with other problem I would have had the chance probably. I got the same result for testcase 1 and 2 from the solution, but the third one made me want to throw my laptop

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

    relatable

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

    It is not increasing it, the answer for the third testcase is a fraction so it is the $$$numerator \cdot modular inverse(denominator) (mod 10^{9} + 7)$$$.

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

    $$$\big(a\cdot b^{-1}\big)\bmod p = \big(a\cdot b^{p-2}\big)\bmod p$$$ for prime $$$p$$$.

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

    You can check this blog about modular arifmetic. Particulary, about modular division, which is pretty common.

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

    exactly same happened with me in the last 1 hour, wish I had solved D instead of trying F for so long.

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

Good balanced contest, thank you authors!

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

Problem F be like:

C++: Wrong Answer on test 4

Python: Accepted

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

    So true. I don't know what is the issue with my c++ code, I handled all the overflows and yet it keeps giving me WA Test 4

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

      Not all. You had overflow

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

        Got it. Totally missed that. sum may overflow when N = 2e5, and a[i] = 1e9 for every a[i] then a[i] * sum would overflow.

        Hard to observe mistake to be honest.

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

      when n = 2e5, n * (n — 1) / 2 overflows

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

        Have you tried $$$\texttt{long long}$$$?

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

    FOR REAL I had submitted two C solutions which got Wrong Answer at test 5. At that point just gave up and used my beloved Python.

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

is my solution for E hackeable?

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

Can someone simplify on what needs to be done in Problem F Sakurako's Box please.

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

    answer = $$$\sum_{i = 1}^{n} \sum_{j = i + 1}^{n} \frac{2 \cdot a_i \cdot a_j}{n \cdot (n - 1)}$$$

    modulo $$$10^9 + 7$$$ of course.

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

      Thank you for the reply. Isn't the denominator (n*(n-1))/2 ?

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

        Yes it is, sorry, I edited it.

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

    There are $$$\frac{n(n - 1)}{2}$$$ possible pairs. Since we want to obtain the expected value, we know that we want to multiply the product of each pair by its probability. Clearly, each pair $$$(a_i, a_j)\, /\, i < j$$$ has the same probability of occurring. This means that the probability of each pair is $$$p = \frac{1}{\frac{n(n - 1)}{2}}$$$. Now then, we can see that the final result will have the form $$$pa_1a_2 + pa_1a_3 + ...$$$. So, we can extract the $$$p$$$s and obtain $$$p(a_1a_2 + a_1a_3 + ...)$$$. Here, we know what $$$Q = p^{-1}$$$. At this stage, you must choose a method to calculate $$$Q^{-1} \mod 10^9 + 7$$$. This can be achieved by any number of methods using the modular multiplicative inverse. The value obtained from this we will multiply with the calculated value of the numerator $$$P$$$ to obtain the final result.

    On the other hand, we must find a way to efficiently calculate $$$a_1a_2 + a_1a_3 + ...$$$. This can be done by simply calculating $$$s = \sum_{j = 1}^{i - 1}$$$ and adding $$$sa_i$$$ to the numerator for each $$$2 \leq i \leq n$$$.

    Hope this helps.

    PS: Please do be careful with the modulos.

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

      Thank you for taking the time to respond in detail.

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

    Both (.-__-. and fisher199) your comments were helpful, and I have solved that problem. Thank you.

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

Just participated — but am not "Trusted member of 3rd Div", i also noticed non of the the usual scoring points on the right hand side of the screen? I solved a few questions but will I get a delta?

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

    You are not a trusted member of Div-3 yet because you've only participated in one contest so far.

    The scoring thing isn't there because this contest use different rules/contest type.

    As long as you register as rated participant and attempt to solve at least one problem you will get a delta.

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

why none of testers tried to check if F is solvable by chat-GPT ?

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

    Why are you using Chat-GPT during the contest? What is even the point of solving a problem with GPT?

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

      first of all, its the author's fault to not check if it's solvable by gpt or not, i can imagine that at least half of the submissions were made by the help of chat GPT (6k is a lot for a typical Div3 F)

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

    imagine using ChatGPT. using it should be banned because it can sometimes solve template problems regardless of their difficulty.

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

couldn't implement G although exactly know what I'm going to do

Spoiler

this can be done by binary search right? 😭

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

    for n>1, you can set the array to 0, gcd, 2*gcd, 3*gcd, ..., (n-1)*gcd. I believe this will be enough for you to be able to solve it now.

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

    Not quite. Compute gcd, let it be G. Then you can always make the array to be of the form 0, G, 2G, 3G ... (n - 1)G. Then finding the kth MEX is O(N).

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

      Damn, I had no idea how to solve G. How did you notice the GCD?

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

        read how to find GCD using euclidean algorithm

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

        Actually fun fact. This is very similar to the most recent Div 2C, which has a quite similar use of the GCD concept. I immediately thought of using GCD because of how recent that problem was.

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

          In fact, G was made before it, so I didn't take it's idea. But yeah, it is somehow similar.

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

          Funnily enough I solved it in contest.

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

          I got the idea almost at once thanks to this problem.

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it
        1. find smallest positive integer x out of set of integer

        2. allow to add and subtract each other unlimited times. gcd naturally comes into mind.

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

how to handle the base case in problem D i spent 2 hours trying to fix the dp solution with a vis array which i was 90 sure is not going to work

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

F was easier than D/E lol.

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

what is the idea for E when n%2 !=0 ?

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

    Iterate over each letter to remove and maintain a count of each character at even and odd positions. Notice that the removal of a character will flip the parities of indices in front of it.

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

      How to make sure that correct letter is being removed?

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

        You don't have to, just try each one.

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

          How this greedy solution could be corrected? I am messing up in in the case when n is odd.

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

      yeah i did notice that, but couldn't proceed further. Is the algo for n = odd something like :

      brute force. for removal of each charactor: calculate the number of operations, and choose the minimum of all such answers?

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

    I just iterated from 1 to n and checked if i delete the current element in string , how many operations would i need to do in order to obtain alternating string and stored minimum of all those operations . For doing it in time limit , I stored the count of occurence of alphabets at odd and even positions at each index.

    You can check this out , there may be better approaches but this came to me

    https://codeforces.net/contest/2008/submission/279203992

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

    You should think if there is a way to calculate de answer for even lengths in $$$O(1)$$$ or $$$O(\log n)$$$, so, you could try to delete all characters and calculate the answer for each resulting string.

    The answer for even lengths could be calculated in $$$O(26)$$$ with prefix sum over the frequencies of the characters.

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

    To calculate the number of operations required for an arbitrary string s, you need to find the maximum count of a character at odd indices and another count for even indices, then subtract both from the size of the string, because that's how many characters you need to change. Also, notice how removing a character at some index i flips the parity of all characters in front. Moreover, if you remove a character at index i and flip the parity of a character at index i+1, then that character will have the same parity for the removals of characters at indices < i. Knowing this, going down from i=n while i>=0 you only need to update the counts related to the characters at index i and i+1, where s[i] is the removed character

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

    We will try removing ith character for all $$$ i $$$ such that $$$ 1 <= i <= n $$$. with some precomputation, at each $$$ i $$$ we can calculate the most frequent character at even positions and odd positions in $$$ pref_{0\cdot\cdot\cdot i-1} $$$. You can do the same for $$$suff_{i+1 \cdot\cdot\cdot n} $$$. During the precomputation you can also store the characters which occur the most in prefixes and suffixes respectively. Then it is easy to observe that whatever balanced string we'll have will contain either of the 4 characters we just stored (most frequent even from prefix, most frequent odd from suffix) and (most frequent odd from prefix, most frequent even from suffix). (After writing some cases you can observe that after the removal $$$ith$$$ character, the parities of suffix flip). and that's it. you can check my submission

    I couldn't get AC during the contest but I just had to add ans = 1e8. feeling super sad rn :(

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

Was G somewhere related to gcd of whole array if yes then why my solution is giving wrong

if no please help me in solving it

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

    upd: got it just it just an extra equal to symbol

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

I haven't used the platform in a while, how can I know if it's unrated? In my case, I would like to know if this contest was rated. I checked the contest link and it shows this:

You registered for the contest as: pabloTabilo: contestant

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

    When you register you have an option below either to choose rated or unrated. By default it is rated until and unless you chose unrated.

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

Could someone please identify what is overflowing in my F solutions?

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

    Probably this line:

    for(int i = 0; i < n - 1; i++) sum += ( a[i] * prefixSum[i + 1] );
    
»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

explain why people use prefix sum to solve H please :(

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

    That's a very standard trick. It even appeared in a recent CF Problem : Med-imize.

    I added more details here

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

    I precalculated the answer for each x by binary search. Since $$$a_i \leq n$$$, each x splits the numbers int $$$\frac{n}{x}$$$ patterns of $$$0, 1, 2, ..., x - 1, x$$$, I used prefix sums to avoid iterating over that.

    My submission: 279218027

    Time complexity: $$$O(n log^2{n})$$$

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

wonderful set of problems! i managed to do my first two problems :)

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

This is my best CF round — I am top 2000!!!

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

I wasted 30 extra minutes on E and had no time for F :(

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

Will you release an Editorial/Tutorial?

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

neal Congrats for actual Rank 1!

Funny how even the top 10 in ranklist people cannot code G correctly.... authors, testers do better. Wrong models really shouldnt be happening.

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

Here is my solution link, written in Simplified Chinese.

The solution of G before constrain modification is included.

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

Am I the only one stucking at implement of E?

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

    I tried for like 20 mins and then went to F, and glad I did, F was easier than even D.

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

I believe my first solution for H is hackable. I imagine O(n^2) in the worst case, but it's hard to analyze the complexity.

If someone is interested in hacking, take it)

Basically instead of doing a binary search I'm trying to calculate current result as +1/-1 from the prev result (in the loop). So if we have tests where the result sequence is 0->n->0... then my solution is quadratic.

https://codeforces.net/contest/2008/submission/279227245

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

The problemset needs to be rearranged, C<B F<D&E!!

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

    Once you read problem properly then B was more straightforward than C (i overkilled B then saw the statement again after contest), no comment on F.

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

      B was alot of work but c was easier to approach and to implement. (it's just from my POV).

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

        See this solution to B, it was this easy.

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

          THX!I thought Just counting would give me WA, based on the statement so I just brute forced!

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

    The hard part about problem C is proving the simplest solution runs without the risk of TLE. Which I think not many people did.

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

this could be as easy as a div4, anyway good contest

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

From my deepest point in my heart i hate cheaters

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

    you're a cheater, bro, rating matters more bro, no one cares about your self righteeousness get answer from chat gpt or telegram oa group to get good rating, and placement

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

Should've started doing G earlier instead of wasting my time in E I was just one line away from solving it :(

Still happy with my performance though, Div 3 is so fun! I wasn't just stuck at 3 solves like in Div 2, knowing everything else is impossible for me.

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

https://codeforces.net/contest/2008/submission/279214387

Does it help to not get banned? =)))

int someIrrelevantFunction(int someParameter) {
    return someParameter * 2;
}
»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Someone help me. I don't understand codeforces at all. I don't understand divisions, ratings, trusted players, unrated contestant....I read some cf articles.

First time participated in this Div 3 contest, solved like 3 problems(A,B,C). Why still it shows unrated player?

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

    Uncheck the "show unofficial" checkbox and you'll get a normal standing.

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

    Lol, after seeing your B solution i now realized how bad i am at reading the problem, and with the fact that it was written in bold that the string is made from a beautiful matrix.

    Anyways, level of contest: Div1(for people rated > 2100) > Div2 > Div3 > Div4
    You will get your rating once final evaluation is done, for Div3, Div4, Educational round(level between Div2 and Div3) there are 12 hrs hacking phase after the contest(search about what is hacking in CF)
    If you have registered rated then you will get rating tomorrow.

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

please explain how you got this answer to test 3 from example in F. Why 8 isnt the answer?

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

    I also don't know how he got, so I stuck into it until the ending of the contest.

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

    I found someone wrote down in his/her solution

    res = res * fpow(n * (n - 1) / 2 % mod, mod - 2) % mod;
    

    What is it????

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

    i mean there's a whole paragraph telling you to take the answer modulo M. basically when you divide two numbers, you will multiply by the denominator's mod inverse. which is equal to X^(MOD-2)

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

    The sum (numerator) is $$$85$$$ while the denominator is $$$10$$$.

    $$$85/10$$$ is $$$8.5$$$, not $$$8$$$

    here you are required to print the answer to the mod of $$$10^9 + 7$$$ Since you can't use mod on a float value, you need to use mod inverse.

    note that $$$ (a / b) \% m \neq (a \% m) / (b \% m)$$$

    instead

    $$$(a / b) \% m = (a \% m) * (b^{-1}) \% m$$$, here $$$b^{-1}$$$ denotes the mod inverse of $$$b$$$.

    To calculate the mod inverse of a number $$$b$$$ for the mod of $$$m$$$ you can use this formula:

    $$$(b ^ {m - 2}) \% m$$$

    This can be calculated efficiently in $$$O(log(m))$$$ using binary exponentiation

    This only works if the mod is prime

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

I know that pE is only prefix sum with odd/even index. But, I don't know how to write it efficiently. My sol is fucking LONG and still having some bugs.

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

Do I get a penalty for wrong submission on the problem which was not finally accepted

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

Though I wasn't cloudflared during the contest, I still spent more time loading pages than solving problem in ABCD. Perhaps I need to open all problem pages next time.

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

Is this solution to B fine? https://codeforces.net/contest/2008/submission/279237030

Lol I missed this condition during contest — R = C = sqrt(n)

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

In problem B, since the string is always made from a perfect binary matrix, is it sufficient to check if the count of ones equals to 4 * (r — 1)?

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

This submission is failing on some test case. Problem G

https://codeforces.net/contest/2008/submission/279239206

Can anyone tell me why this is happening.

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

    For this case:

    1
    3 1
    6 10 15
    

    You can operate on the array like this

    $$$[6,10,15]\to[6,10,5]\to[1,10,5]\to\dots\to[1,0,2]$$$

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

    Fixed it, Thanks

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

is D was so easy? My dfs function a bit hard

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

    D was not so easy, but at the the same time, it should not have taken me a whole half hour to solve.

    And if you are wondering how so many people submitted D, the solution for D was -

    1) -> Easily solvable by chatgpt. The problem setters did not check to see if chatgpt was able to solve the prob or not.

    2) -> Leaked within the first 10 minutes of the contest(I think) because, I have know a noob guy from my college, who does not have any clue about even basic BFS and DFS, but submitted the B,C and D within 13 minutes!!

    So yeah, that should answer your question.

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

    it could be done using dsu. you dont need to write complete dsu, just its template, and how it works

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

TL for G is actually insane, how is this TLE? 279241104

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

    It has an integer overflow, because r is initialized with unnecessarily large number.

    Suppose $$$k=10^9$$$ and you have some distinct elements, then the answer is obviously larger than $$$10^9$$$. in this case, when mid is 1E9, good(mid) will return true, and therefore l becomes 1E9. Because r is still 2E9, (l + r) overflows.

    See the fixed version: 279244131.

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

      ah, just realize overflow issue causes loop forever thanks.

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

Got fucked up in first problem, tried twice and solved in third attempt!!

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

How can I delete a comment?

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

hope Cheaters will be identified....

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

performed very bad :( should have taken mod of q also

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

279181406

Can some one please highlight the error in this solution?

I used this formula (Numer/Denom) where,

Numer = sum of (A[i]*(sum(A)-A[i])); for i=1 to n;

Denom = n*(n-1);

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

    n * (n-1) can overflow before it's modded

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

      That's not the case since I use #int long long

      Anyways I got my silly error:

      In my code, Correct:

      int val = (A[i]*((cSum[n]-A[i]+MOD)%MOD)+MOD)%MOD;

      Wrong:

      int val = (A[i]*(cSum[n]-A[i])+MOD)%MOD;

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

Can anyone please tell me why this solution gives tle and this one does not?
In the first one (for the reason I can't understand), instead of counting the numbers in the range [a,b],I pushed all those number in a vector and printed the size of that vector.

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

    vector push_back needs to resize the whole vector occasionally, but it all adds up into the time taken to run the whole program

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

      Thanks man but can you explain it in a bit detail if it's okay for you!

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

        Sure, you can check the Complexity of push_back in this link

        It says Constant (amortized time, reallocation may happen). If a reallocation happens, the reallocation is itself up to linear in the entire size.

        So that's exactly what happen. You can avoid that reallocation by using the .reserve() function to allocate upfront, or the best thing to do in this case is just not using a vector at all.

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

Prefixforces

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

any one has idea how to solve E with dp I don't get how it's tagged as dp

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

i got TLE on problem H three times before i realised that a test case can query the same integer multiple times

and i didn't memo that .-.

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

when the rate of contest will appear in my profile

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

Here is some feedback from me. The issue on G was unfortunate, but it can't be helped. However, even without that, I think some problems were also a bit too typical and some things could have been improved.

  • A: The problem itself is okay, but the constraint is a little sad. It could make it more obvious that $$$2^{a+b}$$$ solutions could pass or shall not pass. Most of the hacks on A are about such bruteforce solutions.
  • B: If I remember correctly the description of squared wasn't very clear initially without the last sentence.
  • C: The optimal strategy to make longest array, and that only $$$r-l$$$ matters is too obvious and trivial. The problem could've added something more than that.
  • D, F: These problems were way too typical even for a Div. 3, and don't really require anything other than the basic required algorithm itself. I think problems that only ask whether they know a specific technique or not should be avoided in a rated round.
  • H: Honestly I see no reason for this to be a query problem that allows duplicated queries. There is no point in giving the same query multiple times, and saving the answer is tedious while it leads to huge boost in execution speed in the worst case for many kinds of solutions (but hard to prove the complexity). It could've been more clean to just make it print all answers from $$$x=1$$$ to $$$x=n$$$.
  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Same thoughts on A. Like if you want to force the greedy just put 1e9 in the constraints, and also Idk why some codes pass and others are hacked while implementing the same complete search solutions.

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

    Hello can you hack my H which ig has tc of O(n(logn)^3)

    279221504

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

    Hi. Thanks for the feedback. I appreciate it and I will consider it in the next contests. Here is what I can say about some of this:

    • A: There is a rule for Div3 that constrains in the first task should be small. I think it is made for solution like $$$2^{a+b}$$$ to pass, for the programmers who only start competetive programming.

    • D,F: I think you are right, but here is reasons I put it in the contest. There is not a lot of tasks, where expected value or dividing permutation on cycle are in a some simple way, so when I first saw task expected value it was to hard for me even with tutorial. So, I wanted some more easier tasks to be here on at least some topics. I understand that there is a lot of sites, books where you can learn this, but when I was only starting CP I didn't know any of that.

    • H: To be honest, I thought about it, but here is reasons I didn't want to do these version:

      1. It seams like a good hint for this solution.
      1. If you will try to brute force in this version (in a way $$$\frac{n}{x}\cdot log(n)$$$) for each number you can get AC without even understanding the solution.
    • This is why there is queries.

    One more time thanks for your feedback. I don't have anything to say about B and C, because probably you are right.

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

      I can see your reasons behind the other things, but I still don't get about A. If that was your intention, then the constraints should have been even lower, because many $$$2^{a+b}$$$ did NOT actually pass and got hacked or FST. It could've been also done by guaranteeing distinct test cases, but even that was not the case.

      So the only reason I can think why it's so small is just because it's a 4A problem, and I've seen this quite a few times on other Div. 4/3 A problems. It really feels like these constraints are not decided based on actual solutions that it wants / doesn't want to pass, and rather just want to be 'somewhat small'. I understand why the coordinators want to include every possible case in one test, but I honestly don't see why the number of test cases cannot be something like $$$1000$$$ in these problems with larger constraints. The only thing it would do is to take just tens of milliseconds more for any viable solution that is not exponential. If they actually intended to allow any viable exponential solution, then the constraint should be like only 1 digit. For now they're neither of these cases.

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

Why is rating not updated yet ?

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

I have registered as rated in this content but still my rating has not changed in it.

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

Can anyone tell me why this code get WA in B?

1.n must be a square number, like 4,9,16,... 2-(1) n=4 will be yes. 2-(2) n>4, if s contain '0' will be yes, otherwise no.

Any bug in this logic?

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
 
    int T;
    cin>>T;
    while(T--)
    {
        int n;
        string s;
        cin>>n>>s;
        int k=sqrt(n), cnt=0;
        for(auto &c: s)
            cnt += (c=='0');
        if(n!=k*k)
            cout<<"NO\n";
        else
        {
            if(cnt || n<=4)
                cout<<"YES\n";
            else
                cout<<"NO\n";
        }
    }
}
»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Have the ratings been updated? I don't see any changes, and the 3 problems I submitted and got accepted are for some reason showing "in queue" today.

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

I submitted solutions for 6 out of 8 problems, and now it shows that only the 1st is accepted, and the rest are in red or in the queue.

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

    That's because System Testing is currently going on. Wait for it to get over and you're attempts will be back to normal.

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

    at first I was so amazed by the fact that its you first contest and you submitted 6/8 problems kinda cool. then I wanted to look your submission and when I saw you submissions of problem A, you took two inputs in array (alright great for beginner) but then your submissions got drastically changed with maturity of variable selection and formatting. I was having mixed thoughts in my mind until I looked at E's Submission and I got reminded of a random comment. Well you know I know what I am talking about but CF is all about fun, please enjoy!

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

When do we get our rating score at Codeforces Round Div 3?

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

when will the system testing end ;(

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

Moderators I would like to report this guy almighty_xd with submission of E 279219069 . Vladosiya Pa_sha

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

why does the rating not update ?

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

    Its the same for me I checked it has been updated for some users but its showing unrated for me and for you too i dont really know why?? maybe someone can help us understand the codeforces rating system

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

      yep, i saw a few "trusted participants" people, but its the same for them

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

Why is my rating not changing?

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

Why the rating changes are so low? can someone explain if they know?

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

Why did I not get a delta this time?

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

So lucky to have E passed in 1999 ms. 279208099

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

Can someone please tell me whats the problem with my solution for Problem F?

https://codeforces.net/contest/2008/submission/279375562

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

For problem B I can't understand how just count of 1s equal to perimeter condition is passing all tests 279233678. For s = 111111110 the above approach should say it is a beautiful matrix but the representation doesn't look like that.

matrix representation of 111111110
  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Lol yeah, that solution doesn't look correct. Very interesting that it passed.

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

Guessed dufficulty

A — 800

B — 1000

C — 900

D — 1300

E — 1700

F — 1600

G — 2000

H — 2200

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

    F is 1300 at most, you only need modulo inversion to do that

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

      fair ig, but has lower solve rate than D so.

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

nice contest

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

Attention!

Your solution 279153639 for the problem 2008D significantly coincides with solutions AbhiramaSonny/279132413, Harsha_12354/279153639, Rahul_Jahannathan/279158842. Such a coincidence is a clear rules violation. Note that unintentional leakage is also a violation. For example, do not use ideone.com with the default settings (public access to your code). If you have conclusive evidence that a coincidence has occurred due to the use of a common source published before the competition, write a comment to post about the round with all the details. More information can be found at http://codeforces.net/blog/entry/8790. Such violation of the rules may be the reason for blocking your account or other penalties. In case of repeated violations, your account may be blocked.

I recieved this mail and i don't know who AbhiramaSonny and Rahul_Jahannathan i written my solution by own and this is my explanation to my code:

Reading Input:

The number of test cases (t) is read. An empty list (results) is prepared to store the results for each test case, which will be printed later in a single operation for efficiency. Processing Each Test Case:

For each test case, the size of the permutation (n), the permutation array (p), and the color string (s) are read. Two arrays are initialized: visited to track which nodes have been processed. F to store the number of black nodes reachable from each node. Cycle Detection and Processing:

For each unvisited node i (i.e., nodes that haven't been processed), a DFS-like approach is used to explore all reachable nodes, which forms a cycle in the directed graph. Starting from node i, the program follows the permutation, marking nodes as visited and collecting all nodes in the current cycle. Counting Black Nodes:

Once a cycle is detected, the number of black nodes in the cycle is counted by checking the corresponding entries in the string s. Each '0' indicates a black node. Assigning Black Counts:

After counting black nodes in the cycle, the result (black count) is assigned to all nodes in the cycle, since every node in the cycle can reach the same set of nodes. Storing Results:

The result for the current test case is converted to a string and added to the results list. Final Output:

After processing all test cases, the results are printed at once to optimize performance.

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

Dear Codeforces Team,

I would like to address the recent notice regarding solution 279192712 for problem 2008D, which has been flagged for significant similarity with another solution. I want to clarify that this was not intentional and I have never shared my code publicly or with anyone else during or after the competition.If the similarity arose from using a common method or a standard approach to solving the problem, I can assure you that I strictly followed the rules and did not engage in any form of collaboration or code leakage. If there has been any inadvertent leakage, I am willing to cooperate fully and provide any information needed.Please let me know if there's any further action I should take to clarify the situation. I am committed to maintaining fair competition and integrity on the platform.

Thank you for your understanding.

Sincerely, vamsi648603

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

I deeply regret the oversight that occurred when I was writing code on Ideone and unintentionally left it in public mode. I sincerely apologize to Codeforces for this mistake. But I assure you that I have learned from it and will be more diligent in the future. I am truly sorry for any inconvenience this may have caused and understand the importance of adhering to the platform's guidelines. Please accept my heartfelt apologies, and I promise to be more cautious to prevent such issues from happening again. Thank you for your understanding. I apologisies for this and don't decrese my rating. I am very sorry.

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

I know that submitting code to code forces from two accounts in the contest is breaking the rules. I have two accounts at codeforces. I mistakenly submitted this round from two accounts. For this reason, was asked by codeforces to post why the same code is on two accounts. I am sorry for my mistake. It will not be like this before. I will be careful. My concern is whether my accounts will be blocked or not. please consider me this time. I will be happy if you don't block my accounts.

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

I am truly sorry for submitting the same code to two accounts. I know that using two accounts is breaking the rules. while submitting the code to one account, I mistakenly submitted it to another account. I apologize for my mistake. Please consider me this time. It will not be like this next time. I will be careful. Please don't block my accounts

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

Where are you?