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

Автор MridulAhi, 20 месяцев назад, По-английски

Hello Codeforces!

The Algorithms and Coding Club, IIT Delhi (ANCC) in collaboration with Tryst, IIT Delhi invites you all to participate in ICPC-de-Tryst 2025.

ICPC-de-Tryst is an ICPC-style team contest, featuring challenging algorithmic problems to be solved in a span of 4 hours, for teams of up to 3 members.

Join this WhatsApp group for more updates.

The problems were prepared and tested by Proelectro444, Soumil69, VijayBalaji, lucky__389, mayank69goel, ErrorAssassin, Azm1t, ghoul932, BladeRunner, etherinmatic, MridulAhi.

Prize Distribution

UPD1: Contest link

UPD2: The Contest is delayed by 30 minutes and will start at 19:30 IST due to registration issues at codeforces. Please register carefully this time, as registrations can't be changed due to some technical issue.

UPD3: Editorial

Good luck and happy coding!

ANCC, IIT Delhi

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

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

Contest clashes with cc starters.

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

Where's the contest link? when will it be visible??

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

team up?

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

Correct me if I am wrong, but for B, do we divide the array into blocks of size 2 * k and find answers in 3 * (k — 1) for each block? So it takes 3(n/k)(k — 1) operations that are less than 3n.

For each block, we find the aggregate for suffixes and prefixes in k — 1 operations for each half and merge answers from each half in at most k — 1 operations again.

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

    How do you find the required value for each subarray of length k using this? The intended idea is to partition the array in block sizes of k, and finding aggregate for each prefix and suffix of the block, after which we can find value for each subarray of length k in at most 1 query.

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

      Same idea. I meant that we divide the array into blocks of 2*k, calculate prefixes of the right half of size k and suffix of the left half of size k, and merge in 1 query for all k-1 arrays for which we don't know the answer. btw, cool contest!

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

Can Someone pls Provide Hints/Solution of A.

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

    Since a diverse subarray contains at most $$$500$$$ distinct numbers, any element’s frequency is at most $$$500$$$ in it. Iterate over $$$r \in [1,n]$$$. Maintain a set $$$\mathcal{S}$$$ that stores the last index where each element in the current prefix $$$[1,r]$$$ appears. Maintain an array of length $$$501$$$ where the entry for $$$y$$$ stores the largest index $$$l'$$$ such that $$$\text{max_freq}[l',r] \ge y$$$. Iterate over ranges of $$$l$$$ with fixed value for distinct numbers ($$$x$$$) in $$$[l,r]$$$ using $$$\mathcal{S}$$$. Take the intersection of this range with the range where $$$\text{max_freq} \le x$$$ and add it to answer. The overall time complexity is $$$O(n \log n + n \cdot \max(a_i))$$$.

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

What's the intended solution of problem C?

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

    Greedily remove subtrees of size $$$\geq k$$$ from the bottom of the tree. Tree is decomposed into chains using HLD to maintain subtree sizes. $$$O(n/k)$$$ segment tree operations are needed to find the value for each $$$k$$$ so overall time complexity is $$$O(n\log^2 n)$$$.

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

      Can you explain how this is $$$O(n * log^2 n)$$$ ? , I simulated this obvious greedy using HLD but my complexity seems to be $$$O(n * log^3 n)$$$ because you remove at most $$$O(n * log n)$$$ edges and for each edge HLD update is $$$O(log^2 n)$$$

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

        Only the chain having the root of the removed subtree needs to be updated. When a chain is no longer useful, then add its remaining node count to its parent chain.

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

is K designed to have tight memory but generous TL?

I can't get rid of MLE on test 36, tried all sorts of memory optimization but can't

Intended is Virtual/Auxiliary tree right?

https://codeforces.me/gym/595453/submission/310268897

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

Please provide your ANCC club (IIT Delhi) codeforces group link, so that we can solve such more interesting contests.