Just feel having a stack of unsolved problem in mind is actually quite good since you can literally thinking about them anytime anywhere.
And I've mind solved a few red problems these two day when I can't use my notebook😄
Just start reading a MO book and I found it cover most of the basic combinatoric/number theory knowledge for CP very well. I haven't seen such a complete compilation of such thing, usually these things are scatter around various blogs/problems in my experience :P
btw, I was trying to invent some ARC-style problem initially, but it's far harder than I thought. most of the problems I came up either turns out too impl heavy or the thinking part is too less / non-interesting. seems I still have a long way to go for problem setting.
Everything is finally over, I think I can write sth about the round :)
[A, B]: simple and easy to prove ad-hoc
[C]: after original C got reject, I can't think of any problem with this diff, they are either too hard or too easy for its position
CF
#958
[A]: ceil((N - 1) / (K - 1))
[B]: after compress 0...0 into 0, check [cnt1 > cnt0]
[C]: k <= popcount(n) + 1, which is achievable except k = 1
[D]: # turns is O(lgn) since after a round, the rest vertices should connect to one chosen node, so max |CC| halve
[E]: casework
Just heard there are a lot of Indian teams register TOPC (preliminaries of Taiwan regional ICPC), was wondering why, I thought only teams in Asia Pacific can participate👀
Just start to have some motivation to solve ABC because I found I can prepare some template while solving them, but maybe I'm overpreparing the template when something like this appear in my default template lol
ABC 366
[A, B]:
[C]: map maintain frequency of each value
[D]: 3D prefix sum, 2D is also acceptable
[E]: calculate contribution of each dimension independently, enumerate x then binary search possible y
[F]: find optimal order then sort then dp
[C+]: thanksfully feecle6418 comes to the rescue with a really interesting problem :)
[D]: a standard problem for div.1, but seems not for div.2
[E]: was thinking about creating a counting problem make use of symmetry a lot, but turns out there are other solution exist?
Just learnt static toptree, and seems it's tree version of segment tree as you can do path/subtree modification/query all in O(lgn) and point update tree dp and even CD on it while the implementation is not hard.
Maybe it would become next generations' segtree?
ABC 368
[C]: total damage deal in (t1, t2] is (t2 - t1) + 2 * (t2 / 3 - t1 / 3), then just binary search
[D]: (the number of vertex whose subtree have [1, K) vertices in V) + 1
[E]: process conditions in increasing order of time, for each vertex v, maintain max time a bus arrive
@akshansh_777
Thanks you! It's time when I create my CF account, so about 5 year? I start to practice much only after studying college though, which is about 3 years ago.
ABC 364
[A, B]:
[C]: greedily pick from large A/B to small A/B
[D]: binary search min x where there are >= k points in [b - x, b + x]
[E]: dp[# dishes eat][sum of A]: min sum of B
[F]: use idea of Kruskal to find MST and maintain set of segments forms a CC
[G]: Steiner tree dp
@FLzY8
sorry, it's kind of hard to cutoff all O(n^4) while keep all O(n^3) pass since the atcoder modint template is insanely fast compare to normal way to deal with mod : (
ABC369
[C]: a subarray is arithmetic sequence <-> its difference array only have one kind of value
[D]: dp
[E]: precompute all pair shortest path, then for each query enumerate all possible order of visiting K edges
[F]: come up with O(nm) naive dp then use segtree to optimize
ABC 354
[A]:
[B]: sorting
[C]: monotone stack
[D]: find the period of rectangle then do some math to find occurrence of each grid
[E]: bitDP
[F]: run LIS for prefix/suffix and check whether a_i can be insert between them
[G]: Dilworth's theorem
Just investigate a bit on how can we find lca faster than <O(nlgn), O(1)> or <O(n), O(lgn)>, then I found this!
by doing this, we can find lca in <O(n), O(1)> online, and the idea behind that blog is pretty clean
Multiplication of Big Integers AC!(394ms)
I was trying to make every entry store value upto 10^9 but it's quite annoying to deal with overflow so I give up and store upto 10^1 and use 1 NTT instead of 3, and turns out it's still quite fast!
ABC
[A]: vector::insert
[B]: test if two segment intersect for all dimension
[C]: binary search
[D]: BFS
[E]: 2 * sum(c) - diameter
[F]: bruteforce a in [1, 10^6], check a > 10^6, b = 2 by taking sqrt(n), you can store all a^b for a in [1, 10^6] to avoid overcount
[G] impl hell
Just rethink about shortest path algorithms a bit, actually none of them would try to avoid using same edge twice, so they are actually computing shortest walk instead of path, but it just turns out 1st-shortest walk would always be a path.
An example to verify this is that, if
AGC 067 oxxxx
[A]: G must have clique with size n / 2, so n can't be too large, then X is clique on G <-> X is independent set on complement of G, and G is good <-> comp(G) is bipartite.
ABC 362
[A]:
[B]:
[C]: check sum l <= 0 <= sum r
[D]: Dijkstra
[E]: for all O(n^2) d for arithmetic sequence do dp
[F]: for each edge, upper bound of # match cross it is achievable by letting every (x, y), x, y belong to different subtree when rooting centroid
[G]: AhoCorasick
tried to find a random icpc problemset on baekjoon and sorted the problem by difficulty then virtual it as if I'm doing some cf round. It was quite fun!
[F]: d is valid degree sequence for tree <-> d_i > 0 for all i and sum of d_i = 2(n - 1), then greedily increase the degree of vertex with min cost
[G]: use hld-like dp to maintain frequency of each color under subtree
ABC 359
[A]
[B]: if a_i == a_{i + 2}, ans++
[C]: we can go to (±1, ±1) or (±2, 0) in one step, use the first to make s_y == t_y then use the second to make s_x = t_x
[D]: bit mask dp
[E]: monotone stack