USACO2021 Dec.银组USACO 2021 December Contest, Silver 题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15716567.html T1 Closest Cow Wins 题目 Farmer John owns a long farm along the highway that can be considered somewhat like a one-dimensional number line. Along the farm, there are KKK grassy patches (1≤K≤2⋅1051 \leq K \leq 2\cd...
【USACO2021 Convoluted Intervals 】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15716558.html 题目 The cows are hard at work trying to invent interesting new games to play. One of their current endeavors involves a set of NNN intervals (1≤N≤2⋅1051\le N\le 2\cdot 10^51≤N≤2⋅105), where the iiith interval star...
【USACO2021 Connecting Two Barns 】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15716522.html 题目 Farmer John’s farm consists of a set of NNN fields (1≤N≤105)(1 \leq N \leq 10^5)(1≤N≤105), conveniently numbered 1…N1 \ldots N1…N. Between these fields are MMM bi-directed paths (0≤M≤105)(0 \leq M \leq 10^5)(...
【USACO2021 Closest Cow Wins 】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15716487.html 题目 Farmer John owns a long farm along the highway that can be considered somewhat like a one-dimensional number line. Along the farm, there are KKK grassy patches (1≤K≤2⋅1051 \leq K \leq 2\cdot 10^51≤K≤2⋅105); t...
USACO2021 Dec.铜组USACO 2021 December Contest, Bronze 题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15716414.html T1 Lonely Photo 题目 Farmer John has recently acquired N new cows (3≤N≤5×105), each of whose breed is either Guernsey or Holstein. The cows are currently standing in a line, and Farmer John wants take a photo of ev...
【USACO2021 Walking Home 】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15716395.html 题目 Bessie the cow is trying to walk from her favorite pasture back to her barn. The pasture and farm are on an N×N grid (2≤N≤50 ), with her pasture in the top-left corner and the barn in the bottom-right corner. ...
【USACO2021 Air Cownditioning】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15716347.html 题目 Farmer John’s cows N are very particular about the room temperature in their barn. Some cows like the temperature to be on the cooler side, while others prefer more warmth. Farmer John’s barn contains a sequen...
【USACO2021 Lonely Photo】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15716312.html 题目 Farmer John has recently acquired N new cows (3≤N≤5×105), each of whose breed is either Guernsey or Holstein. The cows are currently standing in a line, and Farmer John wants take a photo of every sequence of ...
【CF2A Winner】题解
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15712426.html 题目链接 题目 The winner of the card game popular in Berland “Berlogging” is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the ...
二分三分小结
本文搬运自本人初中博客园博客,若图片加载不出来,可到原文查看:https://www.cnblogs.com/zhangtingxi/p/15704448.html 二分 对于一个存在单调性的函数,我们要枚举满足条件的最小/最大值,我们通过枚举中间值缩小范围来定位。 123456while(l<r){ mid=(l+r+1)>>1; if(check(mid)) l=mid; else r=mid-1; } 三分 对于一个存在单峰/单谷性的函数,我们可以通过枚举两个端点通过比较大小缩小范围求出峰顶/谷底。 1234567while(r-l&g...














