CF1665C Solution
The content below was generated entirely by machine translation. Please verify its accuracy. If anything is unclear, consult the Chinese source version. Problem link The reading experience is better on the blog. 1. Problem Statement: You are given a tree with nnn nodes. Initially, every node is healthy. Each second, you can perform the following two operations: Spread: For a node, if at least one of its child nodes is infected, then another of its child nodes can be infected. (If multiple n...
How Function Calls Work and What They Enable
The content below was generated entirely by machine translation. Please verify its accuracy. If anything is unclear, consult the Chinese source version. Update on 2022/12/18: thank you to @adpitacor and @iterator_traits for pointing out several typographical errors in the comments. They have now been corrected. Update on 2022/11/24: I was surprised that this article was selected for Luogu Daily. I also feel that my older writing was not very strong, but since it was selected, I want to impr...
Luogu P8270 [USACO22OPEN] Subset Equality S Solution
The content below was generated entirely by machine translation. Please verify its accuracy. If anything is unclear, consult the Chinese source version. Problem link The reading experience is better on the blog. 1: Problem Statement You are given two strings, sss and ttt (the lengths of both sss and ttt do not exceed 10510^5105). You are also given some queries (the number of queries does not exceed 10510^5105). Each query is a subset of the lowercase letters 'a' through 'r'. For every query...
P8269 [USACO22OPEN] Visits S Solution
The content below was generated entirely by machine translation. Please verify its accuracy. If anything is unclear, consult the Chinese source version. Problem link The reading experience is better on the blog 1: Brief Problem Statement There are NNN cows. Cow i(1≤N)i (1 \le N)i(1≤N) wants to visit cow ai(ai≠i)a_i (a_i \ne i)ai(ai=i). If aia_iai has already left to visit another cow, then iii cannot successfully visit aia_iai; otherwise, this successful visit can produce viv_ivi moos....
P8187 [USACO22FEB] Robot Instructions S Solution
The content below was generated entirely by machine translation. Please verify its accuracy. If anything is unclear, consult the Chinese source version. Contents: Brute force Meet-in-the-middle search + map or hash table Meet-in-the-middle search + two pointers + a different from DFS strange state-enumeration method First two-pointer method Second two-pointer method Complete code Problem link The reading experience is better on the blog. 1. Problem Statement You are given nnn two-dimens...
P8095 [USACO22JAN] Cereal 2 S Solution
The content below was generated entirely by machine translation. Please verify its accuracy. If anything is unclear, consult the Chinese source version. Preface: This solution may be rather verbose. I did not solve the problem during the contest, so I wrote the solution mainly to organize my own thoughts. If you already have the idea and only made a mistake in the implementation, I recommend jumping directly to the code section. update@2022/3/13: Thanks to @小木虫 for the reminder: the current ...
P7995 [USACO21DEC] Walking Home B Solution
The content below was generated entirely by machine translation. Please verify its accuracy. If anything is unclear, consult the Chinese source version. 1: Problem Statement Given an N×NN \times NN×N area, each point in the area consists of either 0 or 1. Points of type 1 cannot be traversed, while points of type 0 can be traversed. Find the number of ways to travel from the upper-left corner to the lower-right corner while turning at most KKK times. 2: Analysis When we see a problem asking ...
P2867 [USACO06NOV] Big Square S Solution
The content below was generated entirely by machine translation. Please verify its accuracy. If anything is unclear, consult the Chinese source version. 1: Understanding the Problem Given an N×NN\times NN×N region containing two types of points, J and B, add one J point (or do not add one; when adding, it cannot be placed where a B point already exists), and find the largest square consisting of J points. 2: Analysis 2.1: Summary Because the data is small (N<100)(N<100)(N<100), and ...
P3087 [USACO13NOV] Farmer John Has No Large Brown Cow S Solution
The content below was generated entirely by machine translation. Please verify its accuracy. If anything is unclear, consult the Chinese source version. Problem link The reading experience is better on the blog Preface: This solution may be rather verbose, mainly because I wrote down my entire thought process. Therefore, if you already have the basic idea, or if you are looking for a concise solution, you can skip this solution. 1: Understanding the Problem There are cowcowcow cows and typet...
P2944 [USACO09MAR] Earthquake Damage 2 G Solution
The content below was generated entirely by machine translation. Please verify its accuracy. If anything is unclear, consult the Chinese source version. I saw that the existing solutions did not use an STL vector, so I came to submit one. Problem link 1: Reformulating the Problem There are ppp nodes and ccc undirected edges in a graph, and there are nnn nodes that cannot be deleted. Find the minimum number of nodes that need to be deleted so that none of these nnn fixed points can reach node...


![Luogu P8270 [USACO22OPEN] Subset Equality S Solution](/img/USACO_logo.png)
![P8269 [USACO22OPEN] Visits S Solution](https://cdn.luogu.com.cn/upload/image_hosting/45pac1tr.png)
![P8095 [USACO22JAN] Cereal 2 S Solution](https://cdn.luogu.com.cn/upload/image_hosting/63og5ij1.png)
![P7995 [USACO21DEC] Walking Home B Solution](https://cdn.luogu.com.cn/upload/image_hosting/wv4kqqh6.png)
![P2867 [USACO06NOV] Big Square S Solution](https://cdn.luogu.com.cn/upload/image_hosting/e02vw603.png)
![P2944 [USACO09MAR] Earthquake Damage 2 G Solution](https://cdn.luogu.com.cn/upload/image_hosting/0jw7wfno.png)


![[Stanford CS144] Lab 4 Record](/img/CS144/tcp%E7%8A%B6%E6%80%81%E6%B5%81%E8%BD%AC%E5%9B%BE.jpg)