【杂题乱写】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 into two subsets and force edges between the two sets to be one-directed.
Thus we use to represent the number of ways to divide points label 1~(i+j) into two sets with size and 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 .
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 together cause the length of such segment is
CF461E
No Binary Search.But binary lifting!
If letters in do not appear in the given string ,they can't appear in the target string .
To minimize the operation number,one could just find the longest prefix of appeared in and delete it in . Repeat such process until is empty.
To stop such extension process, DFS on a trie is all you need. Set be the least length of a string begining with character ,ending with character that does not appear in . We want the character force the substring extension process to stop.
By using binary lifting with something similar to matrix mutiplication,we can easily obtain which means the least length of a row of 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 . So do not let the substrings of with a length longer than the upperbound appears in your trie.
Encounter and Farewell
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 can be reached be if and only if we can obtain from by xoring with some numbers not appearing in . If we want to reach all the numbers from to ,then the complementary set of must be full rank. Check this with Linear basis.
To construct a answer,we just connect and get a spanning tree. Here is the original number of j th(st/nd/rd) position in the linear basis.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律