【杂题乱写】2023-11-17

Graffiti board Warnings.

Tasks below are finished yesterday in Yuhui Che's room(When he was watching ugly girls.). I'll write the solution in this blog because the coding work was accomplished just now.

ARC163D

How to count SCCs? We are familiar to the way of divide {1n} into two subsets and force edges between the two sets to be one-directed.

Thus we use fi,j,k to represent the number of ways to divide points label 1~(i+j) into two sets with size i and j and k edges are directed from a small labeled one to a big labeled one(we'll call these good edges later).

To fullfill this DP chart,we add i+j+1 to either set 1 or set 2.Enumerate the good edges in their own sets(0i/0j as we don't really care about their inner structure.).If you insert i+j+1 into set 2,then i more good edge(s) arise.

Time complexity will be O(Poly(n)) and we don't really care about the exponent since n30.

CF1313D

Notice that every child can get at most 8 candies. So we can do bitmask DP while scanning line. Label those operations which currently cover this segment in a dynamic way(use a bin to record the unvisited 1~8)

You don't need to deal with all the events happened at some i together cause the length of such segment is 0

CF461E

No Binary Search.But binary lifting!

If letters in {A,B,C,D} do not appear in the given string t,they can't appear in the target string s.

To minimize the operation number,one could just find the longest prefix of s appeared in t and delete it in s. Repeat such process until s is empty.

To stop such extension process, DFS on a trie is all you need. Set dps,f be the least length of a string begining with character s,ending with character f that does not appear in t. We want the character f force the substring extension process to stop.

By using binary lifting with something similar to matrix mutiplication,we can easily obtain DPi,s,f which means the least length of a row of 2i strings. Greedily append the strings to get the operation number.

It's obvious that by choosing proper characters,we can force the length of the longest prefix mentioned above is always smaller than log4|t|+1. So do not let the substrings of t with a length longer than the upperbound appears in your trie.

Encounter and Farewell

link

How do you confirm that there is a Spanning tree in the graph? For me that is you can reach any vertex in the graph from any starting point. Or you can say it's a connected graph.

Vertex y can be reached be x if and only if we can obtain y from x by xoring x with some numbers not appearing in {A}. If we want x to reach all the numbers from 0 to 2n1,then the complementary set of {A} must be full rank. Check this with Linear basis.

To construct a answer,we just connect ivj and get a spanning tree. Here vj is the original number of j th(st/nd/rd) position in the linear basis.

posted @   没学完四大礼包不改名  阅读(45)  评论(2编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示