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

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

The Programming Club, IIT Indore is proud to present our flagship event, Divide By Zero! The contest will take place on Apr/11/2021 17:35 (Moscow time). This round will be rated for all participants with a rating lower than 2100.

Divide By Zero 2021

Thanks to the following people for making the round possible:

There are 6 problems, and 2 hours to solve them. The points distribution will be updated later.

Update: The scoring distribution is 500 -- 1250 -- 1500 -- 2000 -- 2750 -- 3000.

Update: Editorial is up.

PRIZES: Twenty Codeforces T-shirt will be given to:

  • Top 10 Indian Participants
  • Random 10 from top 100 (rank 11-100) Indian participants

Hope you guys enjoy the contest! See you on the leaderboard!

Update: Here is the list of winners who won T-shirts. We will contact you guys soon. Congrats!

Top 10 Indian Participants

Random 10 from top 100 (rank 11-100) Indian participants

We have uploaded the link to the code for generating random numbers and ranklist here.

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

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

Indian round ,Cool,,, Hopefully I will be gray this round :)

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

why indian guy ?

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

i think its time to change the country part in the setting to india for this round :dicaprio:

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

How is blue coder setting problems? I think rules were changed this year, you need to be at least 2100.

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

As a contributor, I hope my contributions will become positive after this contest XD.

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

One of my little dreams is to see my contributions positive !! Certainly anyone no likes negative contributions, so don't be harsh with me and help me achieve this little dream ..

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

Indian round cool. Expecting to do good and atleast come closer to green :)

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

All the best everyone .... Jai Hind

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

Many indian contest recently. You guys are motivated.

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

Hi Sir, I am not able to attend these contests which startsat 8:05 PM. So, Please Change the timing to Sunday Morning 10:00AM. So, Please consider my request. Thank you Sir

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

On April 6th, a contest was held in Codechef which was prepared by IIT Varanasi. After competing in it I felt it's some what like a classical math question paper than a programming contest. So, is it Déjà vu ?

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

Indian round, cool

insert nationalistic comments

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

China>India

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

good to see India here.

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

I wish this contest have interesting problems and strong pretests.

Wish you all luck and rating increasing)))

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

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

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

1250 for a B problem,The B is going to be some mind-fuck problem IMO.

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

I have a feeling that this contest is going to be terrible.

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

I think it's cool than chinese round,because chinese round is too hard,although it's my country...

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

hope I remain expert after this contest :)

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

Is it rated?

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

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

wake the firck up samurai

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

MikeMirzayanov it's kind reuqest. please no codeforcoes round during CSK matches. As you know this season dhoni last season. I want to enjoy both codeforces and msd. Please atleast change timings of CSK matches

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

The score distribution is wrong, lol

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

Why is my nlogn solution giving TLE for B? 112705441

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

can anyone plz tell me why D wrong on pretest 3??

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

Can someone explain me the approach of C?

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

ModuloForces

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

How to solve D?

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

Can anyone explain why I am getting Runtime error on pretest 1 for problem C? Its working fine on my local machine! https://mirror.codeforces.com/contest/1513/submission/112707395

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

so hard :(

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

For problem A, I noticed someone's solution only printed "-1" if n>=k

So I tried to hack it with a test case of n=3, k=1

But the solution was in python and I forgot integer division works differently in python :(

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

This contest is hard and required to know a lot of Math knowledge, just in my opinion. It is hard for everyone who has no experience. Bye bye Blue. I am back to Cyan soon.

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

    It's harder than usual but not because of the math knowledge imo.

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

    I agree that it needed more math knowledge than usual, but mostly math that occurs pretty commonly in competitive coding, not anything completely out of the blue.

    • A — Adhoc, maybe a bit mathy

    • B — Required some basic combinatrics, so fair enough its pretty heavy math for a B.

    • C — Pretty standard dp, no math involved

    • D — First observation is somewhat math intensive for a D (gcd = min means all elements are multiple of the min), but the rest of the problem requires no other math, just intuition of why Kruskal's algo constructs an optimal MST.

    • E — Pure math, all non-combinatorial observations can be made using just the samples. Then its just standard combinatorial ideas that most 18-1900+ rated participants should have likely come across.

    • F — didn't solve, no comments.

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

For some reason, everyone's problem A sols were hacked but its been reverted

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

Problems were hella good imo, especially D

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

how to solve b

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

    The condition in the problem is equivalent to finding the number of permutations of Indices of the array's elements so that ap1 and apn are bitwise and operation of all of the elements in array a. So let cnt be the number of occurrences of (a1 & a2 .. & an) in array a, if cnt is less than 2 then there is no such permutation and the answer is 0, otherwise the answer is cnt * (cnt — 1) * (n — 2)!.

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

    For intuition, consider n = 2. This has a valid permutation when both elements are identical.

    Now consider n > 2. What if the first and last elements in the permutation are different? Then, this is not a valid permutation since you can always make a 1-element group which has just the larger endpoint, and a (n-1) element group with all the other elements. The AND of the group with the smaller endpoint is strictly smaller so there's no solution.

    Now we know the end points have to be the same. What about the middle elements? Assume there's an element in the middle that has a 0 in a bit where the endpoint has a 1. Then, we can always make a (n-1) element group that will have an AND smaller than the other endpoint. So, every element a_i in the middle must equal the endpoint when ANDed with the endpoint, i.e. satisfy (a_i AND a_0) = a_0. This also implies the endpoints must be the smallest values in the array.

    So the answer is (count_of_smallest_element nCr 2) * ((n — 2)!), assuming there's at least 2 of the smallest element and all values in the array equal the smallest value when ANDed with it.

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

If only I never knew matrix expo, would have I not made three TLE attempts at C, coded the intended dp solution and saved the contest. Unlucky day, though I had fun nevertheless. Good contest.

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

Missed D just by a minute :(

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

I really need to know why my D failed, sumission, else my brain might explode. Please.

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

I just don't get it, why my solution of C fails with TL. Looks like some very dumb mistake, which I don't see.

    int t;
    cin >> t;
    while (t--) {
        int n, m;
        cin >> n >> m;
        long long ans2 = 0;
        while (n > 0) {
            ans2 += cache2[m][n % 10];
            n /= 10;
        }
        cout << ans2 % mod << endl;
    }

This is the main part. The rest of the code is precomputation that doesn't depend on inputs and takes just 124ms.

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

https://mirror.codeforces.com/contest/1513/submission/112698905

This is my solution for Problem C. According to me, its Time Complexity is O (10 * m) which is 2 * 10 ^ 6, which is very well for 1 second, I believe. It is giving TLE verdict on pretest 3.

What can be the possible reason behind this ?

Thank you !

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

Could somebody tell me how to do E and F :<? Thanks <3

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

    For E, we want to reach $$$\frac{sum}{n}$$$ as the value of all elements. Lets call this the $$$\textbf{good}$$$ value of the array, all elements smaller than it as $$$\textbf{low}$$$ elements and all elements larger than it $$$\textbf{high}$$$ elements.

    Clearly a high element can never be made less than good, as it can never be used later as a sink (due to step 4), meaning we can never make it good. Same for low elements and greater than x. For the same reason, good elements can never be used in an operation.

    Now lets notice that if there exists any subsequence of the form $$$\textbf{low high low high}$$$ or $$$\textbf{low high high low}$$$ or $$$\textbf{high low low high}$$$, we can get different end costs by mapping the lows to different highs. So if there is more than 1 low and more than 1 high, we need them to all be separate, that is all lows before highs or vice versa.

    So we just want to arbitrarily choose where to place the $$$\textbf{good}$$$ elements in the array, multiply that by the number of ways of individually permuting $$$\textbf{low}$$$ and $$$\textbf{high}$$$ respectively. (and that by 2 if the array actually has $$$\textbf{low}$$$ and $$$\textbf{high}$$$ elements for the other direction)

    Ways of choosing places of good elements is clearly just $$$n \choose cnt_{good}$$$. Ways of placing low and high can be found is just multinomial theorem.

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

    In E array is balanced if sum is divisible by n and there is no subarray [x, y, x, y] where x is less than sum / n and y is greater than sum / n. You can calculate number of combinations with multinomial coefficient.

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

    Wow now that I realized I misread the problem statements. I thought i can't be source anymore :<. Wonder how many people like me and can't solve E :<?

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

My Submission for C got TLE on pretest 3. Afterwards, including fast I/O and changing for(auto x:s) to for(auto &x:s) ,it got passed. How?

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

I had resubmitted my same correct solutions of first two questions later but my earlier correct solutions were skipped in system testing and my rank got changed .What can I do now?

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

problem A: here take some cheesy math! problem B: here take some more math! problem C: hold on! I got some more math!

honestly speaking, Problem set sucked! you know math you solve it easily, you suck at math you get rammed!

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

Could someone please provide me counter case for my submission of problem D .Test case 3 is very long.

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

The problem C and D are wonderful! Really nice round.I love it.

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

got the idea of solving C when there was only a few minutes left. tried my best to implement it but just couldn't finish in time :'(

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

https://mirror.codeforces.com/contest/1513/submission/112708303 Here is my solution for question c.. which is giving TLE.. but I suppose it's time complexity is O(m*10+t*10) in the worst case.. please explain

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

.

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

https://mirror.codeforces.com/contest/1513/submission/112681391

Can someone please explain why I am getting TLE on this solution of C? I think the time complexity is O(m+t*log(n)) which should run well within 1 second?

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

Incredible contest:)a contest with decent level gradient in the questions.

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

Here I see a lot of comments related to problem C. Most have implemented using a 2d array of size [2e5]*[10].

  • I would like to share that it is possible to solve the question by 1d array of size [2e5] only.
  • No need to preprocess for all digits from 0-9.
  • You can preprocess all answers for zero, and then the answer for digit 'd' would be simply dp[m + d].

But, here you need to note that instead of precomputing till 2e5, you will have to precompute till at least 2e5+9.

You can check my submission here.

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

C is nice!!

Those who are unable to do it let me explain

lets think in this way if the number is this 023109

so if we know that after m operation what is the length if we start from "9" so if we know that after m operation what is the length if we start from "2"

so we just have to add cnt(0,m) + cnt(2,m) ..... cnt(9,m)

where cnt(x,y) denotes what is the length after y operation if we start from x

we can precompute ans for 0 to 9 for each m this wont take O(m*10*10) time complexity which satisfies our time limit

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

I am extremely disappointed with test cases of problem C of this round. I wrote a perfectly correct algo for the problem and was constantly getting TLE in testcase 3 of the problem. After the contest ended i just changed cin/cout by scanf/printf and boooom, it passed all test cases. You should avoid such test cases which show TLE just due to the way of taking I/O.

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

Can anybody help me to find why my solution is wrong for problem B? Thanks in advance. https://mirror.codeforces.com/contest/1513/submission/112687504

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

why is my solution to B giving wrong answer? please tell. 112718984

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

waiting for editorial .....

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

Does anyone have an idea why is this (https://mirror.codeforces.com/contest/1513/submission/112721127) nlognlogn solution too slow?

EDIT: nvm I know where I made a mistake

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

Thanks for your effort!

Problems B, D and E are beautiful and so good in my opinion.

Problem C is just rude because of its TL, in my opinion. It's just about pre-calculation. Testcases are queries, in fact. Matrix exponentiation solution with O(1e3 * log(m) * testcases) should pass, because it is not a simulation solution anymore. Even matrix solution with O(1e3 * 2e5) pre-calculations didn't pass. Why so tight TL?

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

I saw lots of solutions for problem C with precalculating length after m operations separately for different digits. But notice that after applying 1 operation to 1 we get 2, then 3, ..., 9. This means that for example applying m operations to 7 is the same as applying m + 7 operations to 0. So, we can precalc this values for 0 only.

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

My submition is still waiting for recounting(((

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

Does somebody know why identical submission show different results?

Submission 1: https://mirror.codeforces.com/contest/1513/submission/112726786

Submission 2: https://mirror.codeforces.com/contest/1513/submission/112726577

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

Memorable contest for me. I became an expert:)

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

I got this message after the contest:

Attention!

Your solution 112682833 for the problem 1513C significantly coincides with solutions IloveUless3/112679357, jamil314/112682833. 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.

This is my submission : https://mirror.codeforces.com/contest/1513/submission/112682833 This is the other submission : https://mirror.codeforces.com/contest/1513/submission/112679357 I don't see how that is not a coincidence! And I already got another warning in another contest for compiling in ideone (which, at that time, i did not know was a violation of rules)

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

Who experienced rollback rating for this contest? I am unrated this contest and come back to Blue? Some thing went wrong???

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

Can you guys please announce the selected random 10 contestants for a t-shirt from 100?