jay_jani_0011's blog

By jay_jani_0011, 6 months ago, In English

Thanks for participating in the contest! Link to access contest: CodeNite 2025

644977A - Four Coprimes

Author: jay_jani_0011

Solution
Code - aryansanghi

644977B - Permuting the LCM

Author: Dragmon

Hint 1
Solution
Code - jay_jani_0011

644977C - The XOR Array Alchemist

Author: jay_jani_0011

Hint 1
Hint 2
Hint 3
Solution
Code - jay_jani_0011

644977D - Quantum Cascade

Author: BayernForce

Hint 1
Hint 2
Solution
Code - BayernForce

644977E - Drop the Ball

Author: _chrisrex_

Hint 1
Hint 2
Solution
Code - _chrisrex_

644977F - Maximizing Line Graph

Author: Dragmon

Hint 1
Hint 2
Hint 3
Solution
Code - aryansanghi
Code - Um_nik
  • Vote: I like it
  • +48
  • Vote: I do not like it

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

Nice Problems! Thanks for the contest :)

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

Alt Soln for B. find all i from 1 to N which are a factor of k. Take the lcm of all such i's if its equal to k then Yes else No

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

    Fkin hate that I bricked D. I found out that this is just Range Query using segtree but I couldn't think (underconfident) about how to merge the nodes. Should have thinked patiently

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

This contest feels kinda like AtCoder ABC. There are all problems but the last which are just some tech and the last problem just isn't solvable. Though the quality of problems A-E is better, than of a typical ABC, all of them are kinda straightforward.

A — bruteforce

B — cool idea that you can just mix up all of the divisors $$$\le n$$$

C — 2143F - Increasing Xor but easier, though I overkilled a bit with xor basis

D — the problem just says to you that you need to find out how to use segment tree. It also felt logical that the answer is $$$kx + b$$$ and then it's just writing down a lot of formulas and factoring them

E — sort children by a and then find the vertex with the least time out, doesn't feel harder than D.

It's basically a speedforces from A to E, some intermediate problem before F would really be good here, especially since it seems like aryan is the only one who can understand line graphs

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

    Can you share your code for C using the XOR basis?

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

    Hi, thank you for the extensive feedback, hope that you enjoyed the problems. Well, I did have an intermediate problem to give before F, but alas it was on line graphs too(and I have it saved for a future contest, will be held sometime someday), so we decided to go with the current set. I'll take the "especially since it seems like aryan is the only one who can understand line graphs" as a compliment xd(though Um_nik destroyed the problem in $$$1$$$ hr).

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

    can you please explain approach for 3rd one ?as i had observed that first move from right and try to make a[i] as large as possible with a[i]<=a[i+1] but then i realised that order will matters ? we can not do operation from last

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

      You can do it, using XOR basis in O(121*n) greedily by making a[i] as large as possible <= a[i+1].

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

        hey can you please explain one thing when i am iterating from right and then i am adding each element in the xor_basis and now what i am doing if the element adding new independent vector then i am just taking that number and doing xor with the rest of xor_basis to get a number which is less than vec[i+1] and i am trying to maximise it , but still some case get wrong

        can you please tell when i am iterating from right adding xor_basis then upto which xor should i have to take

        like example suppose i have 2 3 10 ok first i add 10 as my basis then while adding 3 i am just iterating on all the xor_basis!=0 then

        for(int j=0;j<13;j++)if(xor_basis[j]!=0 && xor_basis[j]!=x){
                            // dbg(xor_basis[j]);
                            if((x^xor_basis[j])<=ans.back())v=max(v,(x^xor_basis[j]));
                        }
        

        so this how i will get 9 so my array looks like 9 10 then we proceed for 2 now we get new mask which is 1 then if we do the same we will get 1^3 = 2 and 1^10=11 so taking 2 is better but i can take the 1^3^10 so like take all , so through this i analyse that there are may be more test case which can fail my code please let me know as your code is hard to understand

        that how xor we have to take with the help of basis when moving from right ?

»
6 months ago, hide # |
Rev. 2  
Vote: I like it +13 Vote: I do not like it

My Solution for D used matrix Exponentiation using segment trees. as Eout=(pi⋅mi+1−pi)⋅Ein+(1−pi)⋅si

build a matrix as [[E 1],[0 0]] and multiplying with [[pi⋅mi+1−pi 0],[(1-pi).si 1]]

Code
»
6 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

For problem C can we just generate all XOR values with XOR basis then find if there exists N number of non-descending numbers? I think it will work!

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

    That should not work. An element at an index $$$i$$$ cannot be turned into any arbitrary xor sum of any combination of elements of the array. It can only be made into xor of itself with any combination of elements on its right.

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

for C we can use xor basis to solve for n * (bits^2) https://pastebin.com/1fs0jg49

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

does the technique used in E have some common name ? , and it would be helpful if someone recommend similar problem to E, for practice. Thanks.