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

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

Hello, Codeforces!

The Programming Club, IIT Indore is proud to present the 8th edition of its flagship event, Divide By ZeroCodeforces Round #841 (Div. 2) and Divide By Zero 2022, under the annual code-fest, Euristica'23.

You can check some of the previous editions of Divide By Zero prepared by us : Codeforces Round #399 (Div. 1 + Div. 2), Codeforces Round #474 (Div. 1 + Div. 2), Codeforces Round #714 (Div. 2).

The contest will take place on Dec/27/2022 17:35 (Moscow time). This round will be rated for all participants with a rating lower than 2100.

People who had a great contribution to making this round possible:

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

UPD1: Score distribution is 500 — 1000 — 1500 — 1500 — 2000 — 2750

UPD2: The editorial is up.

PRIZES: Twenty 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 :P

About Euristica

Euristica is the annual flagship programming event of The Programming Club of IIT Indore. As part of Euristica, we conduct a variety of online competitions spanning different programming domains. These events are open and free for all, and there will be exciting prizes and goodies for the winners.

Head over to our website to find out more about the competitions.

UPD3: 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.

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

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

As a tester, I am first.

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

Top 10 Indian Participants

Rated ? Unrated ? Also, do we have to register anywhere to be eligible for prizes ?

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

:sadge:

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

Am i indian or not ? How will you find out?

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

My first contest

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

As a tester, problems are quite nice and I feel like you can learn from this round, especially if you are newer to CP.

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

Why are gifts only for Indians ):

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

Why only 9 testers? Also why only 5 div2 testers?

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

As a debut tester, I am confident you will enjoy the problems.

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

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

T-shirt! :)

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

Finally, my first unrated div 2. Yaaaaaaaay!

I waited a whole year to become LGM :)

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

Good luck to all participants.

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

great initiative from IIT Indore. I appreciate that :)

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

Hope to not find any problems related to binary strings, had enough of them in the past contests

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

All the best everyone

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

Just checking my rank

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

I need pants!

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

Well,so good,this is my first round on CodeForces.

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

I am looking forward to the problems of this contest, hoping to surprise me.

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

just curious what happened with codechef?

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

Finally contest after long time..

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

best of luck everyone going to participate after a long time

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

Hope to have a great round!!!!

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

glhf!

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

Hope i will get a +ve delta, multiplied by 2022 too.

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

madarchod b problem first telling take modulo after and ans comes after taking modulo #badproblemsetting #reporttostter

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

Trash Indian round, no even one interesting problem on the problemlist.

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

Totally a trash round. This was not expected from my people

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

C is very frustrating

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

Problem B, with C++ wasted alot of time while fixing for large input.

2022 was divisble by 6 .. was good while using it at last !!

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

D < C

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

Time limit too strict for C

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

Thanks for the contest! Even though problem B is a little bit too cringe in my opinion, problems D and E are really interesting!

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

Print your final answer * (seconds passed since 1 JAN 1970). Why multiplied by this ? Because we are never gonna see this number again!

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

I envy those who did not participate in this trash round.

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

C and D are the worst problems ever existed. Eager to give up cp after doing those

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

My solution O(count_of_squares_up_to_(1<<18)=450 * n) for C TLE'd in java :( What was the intended complexity?

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

How to solve D ? -_-

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

    Do binary search on $$$l$$$. Now you need to check if there is a square of size $$$l$$$ with all $$$a_{ij} \geq k$$$. To do so, we can find the maximal square and just compare its side to $$$l$$$. Finding maximal square is a well known DP problem and can be solved in $$$\mathcal{O}(nm)$$$. Total compexity $$$\mathcal{O}(nm*log(n))$$$

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

What's the solution for F?

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

anyone how to solve B . i got TLE .

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

Can someone explain to me why my code gives WA for n = 1000000000 for problem B? :( 186932175

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

Any hints for D please?

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

Was 'D' a 2D segment tree problem??

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

Was D so easy? Seems like everybody and their mom did it. Best I could think was 2D RMQ then binary search at each point (assuming it to be bottom right corner of square) to find the best L. I think it should pass but haven't ever did 2D RMQs so gave up. What's the intended way?

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

why is n*1.5 solution for C giving TLE

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

is D a graph problem? How to solve** D**

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

How to solve E? Any hint please?

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

For the first time, I am regretting using C++ in CP contests.

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

.

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

I solved E by greedy: pretreat the number of edges with each different weight w (w = 2 to n/2), then try to operate for k from n/2 to 2 as many times as possible

However I got WA. My submission:186947754

Are there any counter examples?

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

Can someone help me with problem C? I was stuck on TLE my idea was to remove the subarrays whose xor are perfect squares from all possible subarrays I generated perfectSquares till the maximumValue xor can take and then solved the problem "calculate subarrays with xor x for each perfectSquare"

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

i used magic to be green cause i love the color but it look like there something hidden in that magic i am coming back to green no plz nooo

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

Good bye 2022!

How to do E? I can't think of anything other than Euler.

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

    Yes, it involves using euler totient function. Basically, try adding (k-1) edges of weight k , starting from the largest such possible k. It's a greedy solution.

    As , k = gcd(u,v). So, obviously k <= n/2 .

    Now, what can be the maximum number of edges (u,v) whose weight / gcd will be k ?

    It will be nothing but the total number of coprime pairs upto n/k. Let's save it in a coprime[] array. This can be easily pre-computed using coprime[i]=coprime[i-1]+ euler_totient(i).

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

whats the idea for c?

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

    Find the number of subarrays whose XOR has an odd number of divisors and subtract that from the count of all subarrays ($$$\frac{1}{2} \cdot n \cdot (n+1)$$$).

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

      thanks, but excuse me did you just transform the problem into its complement? sorry i am a little noob but how can this task be easier than the original task

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

        Claim : Numbers having odd number of divisors are perfect squares.

        Enumerating over squares is easier, so you can try devising in O(n*sqrt(N)) solution

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

        First, n has odd number of divisors <=> there's a integer m where n=m^2

        Then we let xor[0]=0, xor[i]=a1^a2^...^ai, then ai^...^aj = xor[i-1]^xor[j]

        Finally, for each 0<=i<=n we look for how many j such that i!=j && xor[i]^xor[j] is square number.

        We just need to use array count[] to store count of each xor(i), and for each square number sq from 0 to 511^2, we check count[sq^xor[i]] (we check count-1 instead when sq=0, because sq^xor[i]=xor[i] this time), then sum it up over all sq, that's number of bad pairs with i.

        Time complexity:O(n*sqrt(max(a)))

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

      legend

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

E was a very good problem.

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

I think Problem D is a straightforward 2D segment Tree. ??

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

Problem C was decent from the point of logic and everything, but worst setting of this problem ever, too tight limits.

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

Someone please share a better than O(n^2) approach for problem C!!! I could only come up with that and had 2 TLE errors.

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

    You only need to search the perfect square numbers because only perfect square numbers have odd number of
    divisors.

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

    Let xor[i]=a[1]^a[2]^...^a[i],xor[0]=0

    For each xor[i], There are at most 512 different values of xor[j] where xor[i]^xor[j] is square number. So we just need to store the count of each xor[i] (i = 0 to n) and check the count of (sq^xor[i]), where sq is square numbers from 0 to 511^2.

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

How to solve C ? my conclusion: Max value of Xor of a segment can't be larger than (1 << 18 — 1) , so we can check every number between 1 and (1 << 18 — 1) if it has even number of divisors or not, that will take about (1 << 18 — 1) * sqrt(1 << 18) which is acceptable.

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

D is just https://www.geeksforgeeks.org/maximum-size-sub-matrix-with-all-1s-in-a-binary-matrix/ and binary search on answer.
Too standard for a Div 2D

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

    Because the time limit exceeded. Your code must be able to solve the problem (within the specified constraints) within 2.5 seconds. Your submission was not able to do so.

    If you want any useful feedback, I suggest that you briefly explain your approach and trim your code to remove all unnecessary components, so that anyone reading your code can more easily see what you're actually doing. For this problem in particular, you need a time complexity of $$$O(n^{1.5})$$$ or better. Notably, a $$$O(n^{1.5} \log n)$$$ solution (that utilizes a map/dictionary, which is quite a common attempt) generally should not pass.

    Also, why are you tagging Mike for this? This is not an issue with Codeforces; it's an issue with your solution. Even if you genuinely believed there was an error in the system testing (which is quite absurd when over 2000 people have solved it during the contest), you should be notifying those who prepared the contest, not Mike.

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

I came up with a solution for F that goes like:

do polynomial DP where $$$dp[i][j]$$$ is number of sequences of length $$$i$$$ with exactly $$$j$$$ elements greater than $$$x$$$, where $$$x$$$ is the variable of polynomial. Similar for less than $$$x$$$.

Then to compute answer, we have to sum over powers, which can be done using 622F - The Sum of the k-th Powers.

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

Is the optimal path in B the path that goes through the middle? If yes then the answer is $$$2022\cdot$$$ [ $$$2\cdot$$$ sum of all squares with $$$base\leq{n}-$$$ sum of all numbers up to $$$n$$$ ] which is $$$2022\cdot\frac{4n^3+3n^2-n}{6}$$$. Now that needs to be output modulo $$$10^9+7$$$. How to do that?! I tried many times but none of them worked...

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

Fuck me

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

Problem B is exactly the same as BAMO 2017/3

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

Oh well. After only solving A and B, I'll be excpecting a crap ton of -ve delta. I had finished A snd B in just 12 minutes, but I just couldn't come up with a fast enough angorithm for C and didn't have time for D (also no ideas for D). Hoping for better luck next time. But it was not a bad contest.

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

Valiant >>> valorant

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

On problem E:

Only need to search for it and find this comment on CF:

https://mirror.codeforces.com/blog/entry/55822?#comment-591656

ps. I had runtime error on test 1 several times because of Divide By Zero. 186946890

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

can someone tell me what's wrong in this. i am just literally doing whats told and taking modulo in the end


t=int(input()) mod=1e9+7 while t: n=int(input()) ans=((n)*(n+1)*(2*n+1))/6 n-=1 a = ((n)*(n+1)*(n+2))/3 ans = (ans+a) ans=((ans*2022)%mod) # ans=int(ans%mod) print(int(ans%mod)) t-=1
»
3 года назад, скрыть # |
 
Проголосовать: нравится +29 Проголосовать: не нравится

For problem E, after counting the frequency array of GCDs, I used the greedy approach of taking the higher weights edges (as that will result in lower cost).

I did this based on the intuition that small GCDs will occur a lot more than higher GCDs, so if it's possible to get m edges, it should be possible by this greedy approach. Can anyone provide any formal proof for this why adding m edges will always be possible by this greedy (Ofcourse for the case when it's possible at all)?

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

    Suppose that by adding from biggest to smallest, we try to add edges of values $$$i + 1$$$, which can be added as blocks of $$$i$$$. At this point, we either use all of these edges blocks and reduce $$$m$$$ (the number of edges that we need so far), or we use some blocks of size $$$i$$$ and leave some blocks unused. In the latter case, $$$m$$$ will be reduced to a number which is $$$ \lt i$$$, therefore it will be possibile to use smaller blocks.

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

      That's incorrect.

      Let's say if you have three numbers to be taken 2 2 3 and target sum is 4. Then if you take 3 first, you won't be able to make the sum 4 which is otherwise possible by taking 2 and 2.

      Proof would possibly be around the idea that frequency array such as I provided in counter-example above isn't possible because of the fact/property that our frequency array is GCD of all pairs from 1 to N. But I am not sure how to formally prove that.

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

      To fix this proof, we just need to assume that we can add any number of edges up until the maximum number of edges possible to add at once. In that case, the values of the edges are just decreasing 1 by 1 so it will always certainly work.

      We surely have all edge of value up until the maximum edge because we have coprime[n/(k+1)]/k edges of weight (k+1) in our graph, where coprime[i] is the number of coprime pairs less than i. This is a decreasing function.

      Thus, this proof applies to our situation — we can add any number of edges from 1 through the maximum number of edges that we can add in a single operation.

      [Rev. 3: Edited proof]

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

        Are you sure about the case $$$n = 6$$$ and $$$m = 6$$$? It should not be possible actually.

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

          Ah, I realize now that I was getting the number of edges $$$m$$$ confused with the total weight of the edges in the graph! So then we do actually have an edge of value 1 because the weight 2 edge only adds a single edge to our edge limit. A lot of what I wrote was confused, I'll edit the post

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

        We surely have all edge of value up until the maximum edge because we have coprime[n/(k+1)]/k edges of weight (k+1) in our graph, where coprime[i] is the number of coprime pairs less than i. This is a decreasing function. ``

        This is what my proof was missing, thanks!

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

ModuloForces

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

ben stokes round bc

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

I tried to get all square summation from 1 to (n-1) then multiply in 2 then added n*(n-1)/2 . extend to this formula 2*n^2 + n . It's work for the test cases but still doesn't work in 10^9.

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

in problem B i have applied 2*(sum of first n square numbers)-sum of first n natural numbers,is this correct?

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

Nice leetcode contest

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

I got F's sol but electricity cut when implementing it :(

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

TIL — don't use a map unless you have to

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

For Problem B,

Can anyone help why this code is giving wrong output for n=1e9

t = int(input())
m = 10**9+7
for _ in range(t):
	n = int(input())
	a1 = int((n*(n+1)*(2*n+1))/6)
	a2 = a1-n**2
	a3 = int((n*(n-	1))/2)
	ans =(a1+a2+a3)%m
	print((ans*2022)%m)

All output matches except for n=1e9

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

Can someone tell what is the maximum possible $$$xor$$$ of numbers that goes up to $$$2 \cdot 10^5$$$?

My first answer was $$$2^{18}-1$$$ which is under $$$3 \cdot 10^5$$$ but i got runtime error in problem C when my frequency array was only of size $$$2 \cdot 10^5$$$ or $$$3 \cdot 10^5$$$, but when raised to $$$5 \cdot 10^5$$$ it worked.

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

My N sqrt(N) solution is not passing can you tell me intended time complexity please?

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

Do we have to fill some form to be considered for t shirts?

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

I don't know why I wasted 20 minutes trying to debug my dp solution for B before realising it was a simple math formula :sadge:

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

I literally looked up class 11th ncert maths book online mid contest to get the answer of those two sequences in problem B xD

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

OHHHHHH

I could have solved E but I missed a overflow when doing int32 multiplication......

QwQ

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

Had trouble with taking mod in B so i used BigInt instead lol

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

I reach 2023 problem solving before 2023 year :) Hahaha SHAHEEN

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

Why tasks C and D are so standard? Task C is just prefix-xors, task D is just binary search + RMQ. I don't think such standard approaches are good for a codeforces round.

OK, I'm proposing a codeforces round:

Task A: you are given two integers n and k, find how many i such that 1 <= i <= n and gcd(i, i + k) > 1.

Task B: you are given an array, find count of pairs such that a[i] xor a[j] <= a[i] and a[j]

Task C: you are given an integer n, count number of i such that 1 <= i <= n and i contains two adjacent equal digits.

Task D: you are given an string s and a string t, find count of substrings such that s[i..j] <= t

Task E: you are given a weighted graph, and you have to answer q queries: what is the minimal c such that you can travel from v to w, using only edges with weights less than c?

»
3 года назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится
This time I saw pruning, complementary for problem C,
 
I was even trying to exploit the xor property of a^b = c but I am using that property for dp[i][Xor value]
I thought it would be impossible to find subarrays ending with perfect square xor at index i in o(n) time
I missed out the prefix technique of xor which was a standard problem
»
3 года назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

B was really frustrating.But one who set those examples did a great job by giving a big value. Otherwise we would have end up getting lots of wrong submissions.

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

No offence but these problems are more similar to problems created by 5 or 10 years ago.

D: leetcode style. I like it when I was a teenager.

E: mobius things (or other things anyway) on finding coprimed i and j and greedy. $$$O(\sqrt{n})$$$ observation was cool, like what I first met on 10 years ago.

F: Brute force and use method here. It has been 7 years?! wow...

Maybe we can say even my grandma could solve it, someday in the future.

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

giv rating

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

hmmm,unrated?

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

Can anyone post the top-100 Indian participants list.

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

in C ,can someone find out why does my O(n^3/2) doesn't work submission 187026045

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

I've understood the editorial for problem C. Can anyone explain why o(n) is enough to find subarray XOR i mean we didn’t consider like 2-any 3-any....index.

Just considers 1-2, 1---3, 1----n (index) Thanks.

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

how to get that formula in B task?

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

I recently got a message from Codeforces team that my solution 186944749 matches with 186930712 and 186939456 . But I had used the code from the Leetcode(online site) blog which was posted two years back as given comment (link). So MikeMirzayanov please check it once I had not copied any other contestant's code.

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

Hello codeforces! I just noticed that my contest points were reduced to the level before participating in this contest #841 (div.2). Does anyone have any idea why this happend?