Блог пользователя P.V.Sekhar

Автор P.V.Sekhar, история, 3 недели назад, По-английски

Hello Codeforces!

We are thrilled to invite you to participate in Codeforces Round 976 (Div. 2) and Divide By Zero 9.0, hosted as Divide By Zero 9.0 by The Programming Club, Indian Institute of Technology Indore (IIT Indore). The contest will take place on Sep/29/2024 18:35 (Moscow time).

UPD: The contest time has been updated to Sep/29/2024 18:35 (Moscow time), which differs from the previously announced schedule. Please take note of this unusual timing and adjust your plans accordingly.

You will have 2 hours to solve 6 exciting problems.

The round will be rated for participants with a rating below 2100.

Problem Setters:

The problems for this round have been authored by nishkarsh and me.

Acknowledgements:

We would like to extend our heartfelt thanks to:

Score Distribution (Div. 2):

  • 500 — 750 — 1250 — 1500 — 2000 — 2750

We hope you enjoy the problem set and have a great time solving!

Good luck to all participants!

Update: The editorial is here

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

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

Hope to solve till C in this and get close to specialist

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

very nice score distribution, looking forward to the contest

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

As a tester, I forgot when I tested this 💀

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

Big thanks to the problem setters nishkarsh and P.V.Sekhar

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

clashes with AtCoder

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

    For most div 2 participant, AGC isnt even rated, so that works out.

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

    Thank you for the notice. Somehow I though the AtCoder round is the usual 2h long. We've moved the round to avoid the clash.

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

Why did the Contest begin 1 hour early?

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

fire

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

Almost lost hope. Will try to be pupil in this one.

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

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

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

I thought Divide "By Zero 9.0" is a competition. but, it turn out to be a IIT Indore programming club. Excited to take participant in a contest presented by indian programmers.

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

Hope to solve till E in this round and get to Master.

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

    E might be easy since it's score is just 2000, we have to aim for AK (or if F is too hard then speed will matter). Good Luck!

    UPD : Well you are too close. Solving till E will probably suffice (rather we should talk about rank, so top 200).

    UPD 2 : My predictions actually worked, but this is still generally not correct.

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

      Stop confusing score distribution with problem rating. Not sure why this is becoming a common misunderstanding as of recently. The last contest's blog had 3 comments trying to compare div. 2 and div. 1 score distributions as if they are problem ratings.

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

        If you compare div2 contest's E problems, they usually have score >=2500. Last contest, E had score 2000, and you can see how many people solved it.

        And I did not referred it to problem difficulty (at least not directly). Meanwhile, it's true that, more the score, more the difficulty (according to the setter).

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

          I would like to bring out this blog for reference. Scores are not supposed to be compared between different contests, but instead only within a contest. I brought up problem rating because that is the metric combined with speed + penalty that strongly determines a contest performance. There is likely some correlation between rating and score, but from what I have seen it is weak enough to make predictions unreliable. This is especially true for div. 1 or combined rounds.

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

            If we can't compare scores from different contests, then I agree with you. Thanks for clearing my misconceptions.

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

As a participant i wish i will reach Specialist

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

As a participant i wish i will reach Expert

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

Seeing score distribution seems the problem set will be easy. Good luck everyone.

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

    Score distribution only says how difficult are the problems relative to each other, not how difficult they are relative to other problems on the platform, so you can't really make a prediction like this.

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

Why are contests recently

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

well I guess this one's timing balanced out last one's

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

Hope to get a positive delta in this contest!

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

How many problem exist regarding binary strings?

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

I'm really excited to move up the ladder this time. Thanks to your efforts for this contest!

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

hype hype

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

I really want to participate in this race, but this race time will make me sleep an hour later, and I can't accept it

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

nishkarsh sir orz

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

hope full solve to get im xd

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

IIT 's never disappoint.

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

As a participant I wish to reach pupil!

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

No t-shits ;_;

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

Hope everyone except me reach newbie in the contest!

And I reach Tourist in this contest!

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

Why the time of recent rounds are so strange?

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

Technoblade never dies

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

Hope to have enjoying participation

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

mathforces

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

Indians as always are making the worst possible contest.

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

maybe you meant to write div 3 in the announcement?

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

nice div2

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

Damn this contest humbled me

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

baler problem diche

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

Perhaps E should be swapped with D? I think it’s a little bit classic.

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

    Yeah I was a bit surprised a straightforward DP works (at least passed pretest). Thought it may need some optimizations.

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

I think it nice math contest, I enjoyed the proving and solving.

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

shit contest.

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

indians == mathforces .

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

Great contest. Is it only me that felt C is is easier than B ?

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

    C, D, E < B for me during contest lol

    B took ~25 mins to solve while C, D and E took 20, 10 and 20 respectively.

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

    since i knew that every perfect square is having odd divisors, i could do B easily, but C took me much of time for implementation and trying to figure out all cases

    also i have seen the exact B question but only difference is the question had asked to find how many bulbs would be off at end

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

    C is not easy to prove. B is pretty obvious.

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

I hate this problem set :)

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

what's the reason of making TL of D 2s?

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

how to solve F?

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

jeez louise D was tricky to code

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

Speedforces :)

I really feel like there really should have been a problem between E (750+ solves) and F (~20 solves).

E just require you to realize one fact which is fairly standard ($$$x \oplus x = 0$$$) and then code knapsack while F seems to require far more thinking.

So if you have a slow start of contest you have practically no ability to recover since D and E are far more code heavy than thinking heavy.

(disclaimer: This might just be salt due to having a serious skill issue on B)

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

    You don't need to know $$$(x \oplus x = 0)$$$ for E to code the knapsack? You just need to know xor of two numbers $$$< 2^i$$$ is $$$< 2^i$$$. Also, E isn't code heavy at all.

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

I am sorry, but I think this was one of the lowest quality div2s in recent times. I'll elaborate:

A: not like standards for div2A are very high, but this is just very lazy.. and probably repeated for 1e9+7-th time

B: this is just knowledge-check (or google skills check) problem, with very classic and repeated setup

C: this is actually on border of being okay, but still nothing new, and there are like 1e9+7 very similar problems with same idea (just restore answer bit-by-bit)

D: this is also somewhat okay, though not very interesting

E: just way too classic, compilation of two well-known ideas: look at the xor bit-by bit, and expanding brackets in f^2 + apply linearity of expected value to consider each summand separately, with nothing else.

F: if problem asked just to find f(n^k, d) i think it would be pretty nice, but easy, like 1800* at most. and transition from this version to prefix-sum is just straight-up application of algorithm which is way too hard for div2 level (prefix sum of multiplicative function). very weird problem.

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

    Is B actually binary search? Had to code a quick program to show me the pattern there.

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

      i did with binary search, but i think it can also be solved like quadratic equation and little bruteforce (though im not sure). core idea is that there are $$$n - \lfloor \sqrt{n} \rfloor$$$ lamps that will be still on

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

        I hopelessly submitted the one to bruteforce on x, given that (a+1)^2 — a^2 = 2a + 1 so in total there are 2a ones inbetween zeroes. Shit.

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

      Basically all the bulbs which are perfect square, would be switch off in the end, so basically there are n - sqrt(n) numbers that would be switched on. So for smallest n you have to perform binary search with the condition that n - sqrt(n) should be >=k

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

      very bad at casework and implementing but basically if n+sqrt(n)< (the smallest perfect square larger than n) it is n+sqrt(n), otherwise n+sqrt(n)+1

      took half an hour to implement

      i am bad at this

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

      After reading the problem I knew I had to do binary search but I was missing points resulting in 5 wrong answers

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

    how to solve D? is it related to gcd?

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

      Notice that $$$d_i \le 10$$$.

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

        i mean i did, so there are 10 unique modulos, but i just couldnt figure out how to merge and stuff, and i got really confused

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

          (Assuming you fixed your numbers into range $$$[0, n-1]$$$ instead of $$$[1, n]$$$).

          Basically, you can group all triplets with the same $$$(a_i \mod d_i, d_i)$$$ tuple, and start treating all elements in the form of $$$a_i \mod d_i + k \cdot d_i$$$ as a line. Merge that line using prefix sums and a little bit nitpicks.

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

            I feel my solution for problem D is slightly easier to implement: for each $$$d$$$, maintain a union-find for the furthest index we can jump(processed by previous operations), and jump when possible 283622874

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

              Oh yeah, true there. I was a bit overdoing myself with the prefixes.

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

      for each point $$$i$$$ you have to check is there and edge between $$$i$$$ and $$$j$$$ such that
      $$$max(1, i - 10) <= j < i$$$

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

    I agree, I felt I knew close to the full solution as soon as I opened each of the problems for A-E.

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

    Fyi E has an even simpler (and more braindead implementation) approach than yours.

    1. Just realize $$$x \oplus x = 0$$$, so the value $$$x$$$ only contributes if it occurs an odd number of times.

    2. Knapsack to find these "odd" probabilities in $$$O(n)$$$.

    3. $$$a_i \leq 1024$$$, so just do Knapsack to find the probability of each $$$f(S)$$$ (worst case $$$~2 \cdot 10^7 ops$$$).

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

      oh true, I overlooked it (the instinct to expand the brackets in the expectation of square is too strong), thanks

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

    For E you can also dp for the probability of each resulting xor value and just calculate directly.

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

    I agree completely, also something to note on E : it is even more classic than you put it as, because you can just code the trivial n * 1024 dp which comfortably passes without optimizations.

    I am sad that this is the impression indian rounds leave for people....

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

How should I solve problem b. What Skills do I need to learn to do it?

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

Why was dsu giving tle, on test case 7 in D, is there any way to speed up this? and avoid using DSUs?

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

    If you naively used a DSU, you would have to merge at worst O(n) elements for one operation. Since you have m Operations, you can have up to O(n*m) Merges, which is way too slow.

    There are a lot of approaches to solve the problem, but the main observation is that $$$d_i \leq 10$$$. Based off that you could store for each element the last element to update and the merges that you would still need with a specific value of d. Thus, you only need to store how long the updates have to go back for each d, which means that for all elements, you have at most 10 merges backwards. For a merge just use the dsu to merge with the other element and update the amount of updates for the prior element if neccessary.

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

    To speed up you can use 10 dsu (for each d).283663343

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

solution for this contest

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

hell B was such a pain problem man it gave me existential crisis.

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

    To be honest, this is not a big deal since the observation was easy enough to make anyway. And if you didn't make it, you could just write a brute force to print the numbers that don't have an even number of divisors and you would realize instantly that they are the square numbers.

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

How to solve B ? I tried binary search the n, such that n — sqrt(n) is greater than k, but failed in pretest 8.

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

bruh this can't be C solution, I kept thinking for 30 minutes because I thought it can't be that easy. and this B solution wasn't proven for me, but looked correct.. for the output it would be a combination of 0+2+0+4+0+6+0+8 right? I tried to divide (n+1) by 2 and then it would be the closest result for the rule of (x*(x+1))/2 but got WA on pretest 3

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

never cook again

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

Just Another Math/Speed forces

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

Help problem A TLE on pretest 1 although runs instantaneously locally: 283575473

  • »
    »
    3 недели назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится
    while(n >= k){
        ans++;
        n = operate(n, k);
    }
    ans += n;
    • »
      »
      »
      3 недели назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

      Thanks got it. Although it should still pass pretest 1 right ? Or am I wrong in thinking pretest 1 == samples ? Got so baffled by tle that didn't even think anything else.

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

    Possibly you missed the case when k==1, and directly output n, as there might be issues with division with 0 which would give TLE/Runtime Error. Also its kind of like writing n in the base k, and finding the set bits of it

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

WTF was this E

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

my B one line solution

int x = sqrtl(n + sqrtl(n));
cout << x + n << endl;
»
3 недели назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

can anyone discuss B and C approach.

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

    for C, iterate over bits and check if its possible to make the difference of the 2 bits of the first expression equal to the second expression. there are a few cases, and theyre pretty simple to figure out. for B, binary search, and also try to find out for a certain range how many bulbs will be turned on

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

      I just tried c^d and b^d otherwise solution doesn't exist. It was a throw but passed the prestests

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

can someone help me in figuring out why this ac's? I stress tested and added the line else if(inB && inC) a |= (1ll << j); and if(ans != -1 && ((ans | b) - (ans & c) != d)) ans = -1; and someone got ac

link

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

Should have just headed straight to oeis when seeing problem B. Just a find-a-formula problem which only involves keep guessing it until it is right...

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

    Well for what it's worth, I did solve it without guesswork. Bulb $$$x$$$ is on if it's flipped even number of times. Every factor of $$$x$$$ flips it. So "good" bulbs are those with even number of factors.

    Represent $$$x$$$ as its prime factorization, $$$p_1^{n_1}\cdot p_2^{n_2} \cdots p_m^{n_m}$$$. Number of factors of $$$x$$$ is $$$(n_1 + 1) \cdot (n_2 + 1) \cdots (n_m + 1)$$$ (we have $$$n_i + 1$$$ choices for which power of $$$p_i$$$ to include in each factor)

    It's easier to find bad bulbs — they have odd number of factors, so $$$n_i + 1$$$ must be odd $$$\forall i \in [1, m]$$$. So $$$n_i$$$ must be even $$$\forall i \in [1, m]$$$. Which is a roundabout way of defining a square number. So bulbs with square indices are bad.

    I agree that it's guessable, but also liked arriving at the solution, which probably will cost me some rating. Anyway, I'm sure someone with better maths can solve it much faster.

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

    Generate more samples either by hand or with brute force program and find pattern, that's how I did this problem and that's how I solve most of problems that are not obvious.

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

      Yeah this is exactly what I did too and I am quite sure if I did input it in oeis, it would be a much faster solve (Extra important in a contest situation)

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

I tried to solve E first and got Time limit Exceeded by using O(N * 1024). After that, I optimize a lot and when the contest finished, I read other's solution, I see that they just add ios_base::sync_with_stdio(false) :(

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

3 contests se downfall ho raha hai :(

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

Am I mistaken or do the authors actually allow a $$$O(N \times 1024)$$$ solution for problem E?

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

Man, these problems are just so bad.

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

only if in C had something to do with carry also ;(

an initial impression made me think of the case (0,1,1) and (1,0,0) (bits of b,c,d resp.) had something to do with carrying a bit over, had this covered in code and when stress tested it found that this is not the case T_T

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

it is too hard,harder than all div 2 I have participate in. perhaps I am not qualified to these div2s

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

Poor contest, people had WA's in C before the announcement was made.

the limit of a<=2^61 wasn't specified earlier, i think, the wa's before announcement should be compensated.

eg.- a python user might not face the problem of overflow, for which the constraint was made.

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

came with the idea for C but cant implement it properly any hints??

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

    each bit is independent in this equation

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

    a=b^d

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

      what's the proof?

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

        1) We can solve for each bit independently. 2) Let's analyze all possible cases for some fixed bit position i: 1. If b's i-th bit is equal to d's i-th bit, we may not set a's i-th bit, it will not make our answer worse. 2. If b's i-th bit is 1 and d's i-th bit is 0, (a&c)'s i-th bit must be set, therefore a's i-th bit must also be set. 3. If b's i-th bit is 0 and d's i-th bit is 1, we have to set a's i-th bit to set (a|b)'s i-th bit. By using this analysis, we can claim that if there exists some a, for which (a|b)-(a&c) = d holds, then a = b^d will also be an answer.

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

Mathforces is crazy

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

Literally the worst B i have ever seen

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

I thought this was a nice contest with very nicely written problems. Thanks!

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

For C I've just checked if c^d could be the answer. But it's hard for me to prove it.

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

my worst contest i am pretty bad at maths

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

Did I the only one to solve C by using Digit Dp ?

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

    I solved E using digit dp 😔 we should think more before start programming.

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

And this is exactly why i skip indian and chinese rounds. Questions are so unoriginal invloving mostly math and pattern recognition.

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

I knew that solving n-sqrt(n)=k for n will give me the right answer. I solved it too using basic quadratic math + flooring at the end, and it was actually giving me the correct answer but I don't know why it is failing the pretests. Can someone please tell me why????

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

    maybe u missed the ones when ur answer was a perfect square, the code i made gave me answers like 36, but the real answer was 35 since 35 is smaller and the problem asked the smallest answer.

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

      So basically I should've just checked till what range ans-i is possible. CP can be so cruel!!

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

very strong samples lol

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

Lol, B was binary search? I solved it without binary search: 283591395

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

Unlike other more complicated solutions, my approach to the C problem is simple:

def solve():
    b, c, d = map(int, input().split())
    a = (b | d) - (c & d)
    print(a if (b | a) - (c & a) == d else -1)

t = int(input())
for _ in range(t): solve()

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

Multitest on F. Just why?

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

For problem B: Safe way to calculate sqrtl(num) ?

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

I hate the fact that B solution is just about old Ted-Ed riddle: https://www.youtube.com/watch?v=c18GjbnZXMw

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

i think e is easier than c :(

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

I don't know why my div2A solution wrong 283639751? Can you guys give me some anti testcase please?

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

    Check out my solution.

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

i have no idea what the hell happened but I couldn't even solve problem A in this contest even after knowing the logic within literally 30 seconds of reading the problem, it's the most simple form of a greedy problem. i think i should have just moved on to B instead of trying to fix problem A the whole 2 hours, it was dumb on my part :(

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

    I saw it as writing n in base k. If k = 1, answer is just n.

            int ops = 0;
     
            while(n > 0){
                ops += n % k;
                n /= k;
            }
    
    • »
      »
      »
      3 недели назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      this solution looks absolutely wild, great work. i also realized the k=1 edge case after i kept getting memory overflow errors

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

The fact that I realised about even and odd factors of a number have impact on turning on a bulb but still couldn't realise about perfect squares hurts me more.

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

    I asked ChatGPT: "What natural numbers have odd number of factors?" And It answered perfect squares and then problem is solved :)

    I didn't participate in this contest but if I had, would that consider cheating?

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

      I mean many people go to some kind of websites to find patterns. So it's ok. But I only search for syntax and func in cpp documentation or implementation of some ds.

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

need div 3 or div 4 to recover from the damage this contest has done to me

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

All the authors / testers have too much IQ, so missed what the average caveman would do for problem E.

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

For C question instead of doing for 62 bits seperately u can do this

int x=b^c,y=c^d;

int a=x|y;

if(a|b — a&c ==d) cout<<a<<'\n'; else cout<<-1<<'\n';

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

Love this contest, got WA because I used sqrt() instead of sqrtl() in B, and WA in C because I shifted (1 << i) instead of (1LL << i).

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

Thanks

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

Problem E

My Submission on compiler c++17 TLE but on c++23 1468 ms and I am add this problem to mashup the my solution took time 6749ms on c++17

TLE 283653307 AC 283661649 Please adjust the time limits for this problem and rejudge it

»
3 недели назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
   int ans=0;
    while (n > 0)
    {
        int ank = 1;

        int l = floor(log(n) / log(k));
        int j = pow(k, l);
        n -= j;
        ans++;
    }
    cout << ans << "\n";
}

whats wrong with my code ? 283581784 I think there's a precision error in the log division . I'm not sure, though. and also is there a way to solve it using log or we have option to use only while loop to compute ?

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

DSrinath MikeMirzayanov

I found this account suspicious regarding the use of AI or cheating. The codes submitted are significantly larger, and there is a noticeable difference in variable naming and coding style compared to previous submissions.

In today’s contest:

We can see he used a.begin(), a.end(), whereas in previous submissions he used all(). He used vector<int> this time, whereas he previously used vi. Additionally, he opted for for(...) instead of fr() as he had done before.

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

P.V.Sekhar i would like to draw your attention towards an issue with the Problem B: [problem:https://mirror.codeforces.com/contest/2020/problem/B], i found a user with an accepted solution: [submission:https://mirror.codeforces.com/contest/2020/submission/283584670], and when i am trying to submit this solution again, i am getting wa on 8th test!! WOW! now codeforces is based on luck??

Please look into this. My submission link: [submission:https://mirror.codeforces.com/contest/2020/submission/283668692]

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

Same code different results (╥﹏╥)

C++17: 283654614

C++20: 283666208

P.V.Sekhar nishkarsh

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

For problem B I have submitted the same code twice. -One in C++17 (GCC 7-32) (submission link: https://mirror.codeforces.com/contest/2020/submission/283669977) -Another in C++20 (GCC 13-64) (submission link: https://mirror.codeforces.com/contest/2020/submission/283669075). For te first one I got accepted but got wrong ans for the second one. why??

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

    Because in 20 C++ sqrt returns double. And at 17 — long double This type is bigger. To do this, 20 C++ has sqrtl

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

My submission for problem B failed in Java on test case 8, idk what went wrong! It matches the approach in the editorial.

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

I've got a technical issue.

Is it normal if a submission (https://mirror.codeforces.com/contest/2020/submission/283590461) still has the status "Preliminary tests passed", even if the system testing is completed?

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

for question d why is disjoint set giving tle for me

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

I think E is too easy for Div2.

There is only one simple DP algorithm for this problem.

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

What's the meaning of using Min_25 sieve instead of euler sieve? Does this mean that the usage of technology is the most important thing for a good problem? I can't understand why this problem appears on a CodeForces Round.

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

I'm gonna leave a bit of feedback here.

Overall it felt like the problemset requires too little observation and most of the part was about knowing a few well-known mathematical facts (except for problem D). The reason why many people felt that it's too math-heavy is because the problems were very friendly to math people who studied very little about problems in computer science, but has great knowledge in the math theory itself. Apparently, it is likely that you'll see these problems in math classes:

  • A: It's only about knowing how to represent a decimal number in base $$$k$$$.
  • B: The core of the problem was to know that only perfect squares have odd number of divisors, which is quite a well-known fact. The rest was just about finding a non-error-prone way to implement it.
  • C: Constructing the truth table was enough.
  • E: Because the authors did not know that a $$$1024n$$$ solution existed, it became a very typical DP problem. This solution is quite trivial and involves very little math. However, reading the editorial, the intended solution is quite math-heavy — it was about knowing that linearity of expectation applies here and so that we can calculate each resulting bit independently.
  • F: I couldn't solve this, but watching other people discussing, it looks like a very typical but difficult math topic with a specific way to achieve acceptable time complexity. I heard that using a well-made template reduces the actual solution into like 5 lines.

The statements were short and clear, but it was because that these problems can indeed be expressed as just one-line math equation. I'd love to see problems that require a bit more interesting observations next time.

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

https://mirror.codeforces.com/contest/2020/submission/283654441

Can someone please help why this is failing?

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

SHITY CONTEST

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

I don't know how can I use min25 to pass F, because of T<=10000.

I can construct a test that T=10000, n=100000 at all, in this case my solution can't pass because 10000*100000^0.75 is too large and my constant is a little big.

You can see my submission here 283699912.

I don't think T<=10000 is an appropriate constraint.

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

i hate this E. thought it would never run O(2e8) in 4 seconds.

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

In B question ,first I was submitting on C++ 20 compiler it was giving wrong answer on test case 8. Which after contest same code I submitted on C++ 17 compiler it worked. Anyone please explain.Also yesterday got -47 due to this issue

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

I just got TLE on prob E 9 times, today I resubmit my first code and got AC??

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

Is the Frequency of Contests on this site very low? I don't see any scheduled contests.

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

Well...it looks like we're continuing to go down

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

i'm so bad:((

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

Why did blog get so many downvotes? First time I'm seeing a contest blog with these many downvotes tbh. In fact first time seeing a contest blog with downvotes in general

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

The problem C was easier if done by simple bitwise operations. I tried this. ll ans=b^d; if(((ans|b)-(ans&c))==d) cout<<ans; else cout<<-1;

I think that this was much easier than the solution in the editorial. :P

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

I liked your intention of using "Number Theory" concepts in problems(esp. in F). But, as I have seen, the problems with the blend of concepts in mathematics and critical logical solving are in previous Codeforces Div. 2 (which I participated in).

I support you to continue setting some interesting problems in the future despite the downvotes count.

Fun Fact: I have a -70 delta in this contest, though I got the idea for B in 2-3 min. and C in 15-20 min. which was affected due to my inefficient coding at that time. I love Number Theory ;)

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

Also, I notified that there are similarities in my solution for this contest and also if there was any unintentional exposure of my code (perhaps through public IDEs or similar platforms), it was not deliberate, and I apologize for any misunderstanding. The code idea and algorithm is so clear, this make some solutions make a similarity there are more than 30k participants in this contest and this for sure will lead to similarity and similarity of thinking in creating the algorithm. In the last, take the suitable action and what you see will be correct do it, but don't block my account for little unawareness.

Thank you

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

Hi P.V.Sekhar , nishkarsh, I received below message from Codeforces Round 976 (Div. 2) and Divide By Zero 9.0 Attention!

Your solution 283631407 for the problem 2020D significantly coincides with solutions shrey_gta/283612481, Isaac_Netero/283631407. 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://mirror.codeforces.com/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 do not know shrey_gta, and i did not share my solution to anyone I used the following document for the DSU function. https://takeuforward.org/data-structure/disjoint-set-union-by-rank-union-by-size-path-compression-g-46/

if u can look into this matter, it will be helpful. thank u

»
2 недели назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
Your code here...

int solve()
{
    int n,m;
    cin>>n>>m;

    map<int,vector<pi>> hash;
    while(m--)
    {
        int a, d, k;

        cin>>a>>d>>k;

        hash[d].push_back({a,k});
    }
    auto conv = [&](vector<pi> &vec,int d)->vector<pi>
    {
        sort(all(vec));
        
        vector<pi> ans;

        int sz = vec.size();

        for(int i=1;i<sz;i++)
        {
            int &a = vec[i].first , &k = vec[i].second;

            int &pa = vec[i-1].first , &pk = vec[i-1].second;

            if(a != pa)
            {
                if(((a - pa) % d) == 0)
                {
                    int lt = a + k*d;
                    int prev_lt = pa + pk*d;

                    if(prev_lt >= a)
                    {  
                        k = (a + k*d - pa) / d;
                        a = pa;
                    }
                    else 
                    {
                        ans.push_back({pa,pk});
                    }
                }
                else 
                {
                    ans.push_back({pa,pk});
                }
            }
        }


        ans.push_back({vec.back().first , vec.back().second});

        return ans;
    };

    for(auto &itr : hash)
    {
        itr.second = conv(itr.second,itr.first);
    }

    DSU dsu(n);

    for(auto &itr : hash)
    {
        int d = itr.first;

        vector<pi> &vec =  itr.second;

        for(auto &it : vec)
        {
            int a = it.first , k = it.second;

            for(int i=1;i<=k;i++)
            {
                dsu.unite(a - 1,a + d*i - 1);
            }
        }
    }

 
    int ans = dsu.countComponents();

    return ans;

}

Can anyone help me debug my solution to D problem? (WA at test 2)

I have merged APs with common terms and differences and then used classic DSU.

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

how

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

    I did not share my code with anyone and did not copy code from anyone, maybe we have the same way of thinking but I did not share or copy code!

    You do indeed have the same way of thinking, since you're the same person.

    During contests you submit as many times as it takes for you to get solve a problem from bkdn24.__hide...

    ...and then conveniently submit the same code (with some useless variable name changes that makes you feel smart and undetectable) from bkdn24.ntth

    In case you are too dumb to realise, this is cheating. Stop crying and do better.

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

orz

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

In 2020B - Brightness Begins,

What is special about test case 854258779689358055?

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

why is this disliked alot?