Proelectro444's blog

By Proelectro444, 14 months ago, In English

I hope you liked the contest. We apologize for the inconvenience caused due to the problem $$$I$$$.

595453A - Diverse Subarray


Author: Proelectro444

Solution

595453B - Assosiative


Author: Proelectro444

Solution
Interaction

595453C - Large Regions


Author: ghoul932

Solution

595453D - Another Mex Problem


Author: Soumil69

Solution

595453E - Boredom


Author: BladeRunner

Solution

595453F - Count Valid Arrays


Author: BladeRunner

Solution

595453G - Array Walking


Author: MridulAhi

Solution

595453H - K+1 not K


Author: BladeRunner

Solution

595453J - Mex Tree


Author: Soumil69

Solution

595453K - Tree and Queries


Author: Azm1t

Solution
  • Vote: I like it
  • +65
  • Vote: I do not like it

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

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

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

Awesome Contest

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

You can solve C in O(N sqrt(N)) with no complicated data structures.

Let f(k) = answer for k. We can find each f(k) in O(n) time with a simple dfs greedy.

Note that f(k) is decreasing and f(k) <= n / k

Then, we can use the solution to 2018E1 - Complex Segments (Easy Version) to find all values f(1), f(2), ..., f(n) in O(nsqrtn).

Overview : A simple approach for nsqrt(nlogn) would be notice either k <= sqrt or f(k) <= sqrt, and for the latter case we can binary search what k's will have that specific value of f(k). A divide-and-conquer implementation of this will be O(nsqrtn) for reasons my rating doesn't allow me to understand.