balanced lineup 25045 usaco
P8095 [USACO22JAN] Cereal 2 S 谷物早餐
# P8095 [USACO22JAN] Cereal 2 S 谷物早餐 [P8095 [USACO22JAN\] Cereal 2 S - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)](https://www.luogu.com.cn/problem/P8095) [TOC] # ......
P1216 [USACO1.5] [IOI1994]数字三角形
自己的思想:要用逆序,但是某个未知的位置可能存在一个非常大的数,因此不知道如何dp 看题解之后:对于倒数第二行的数,可以算出它们的最优解,依次往上推,第一个数就是整体的最优解,其实本质上可以用隔离意识来看,在搞最后一排时,将前面所有排隔离掉,在处理中间的每一排时,又将其他排隔离掉 接下来写一下代码 ......
CF1814D Balancing Weapons
[CF1814D Balancing Weapons](https://www.luogu.com.cn/problem/CF1814D) 原题明显可以转化为: 给定一个长度为 $n$ 的数组,初始为 $p_i$。可以调整元素的值,但第 $i$ 个元素必须是 $a_i$ 的 **整数** 倍,并且 ......
P1672 [USACO05FEB] Feed Accounting S 题解
给 $c$ 个区间表示牛吃草的时间段,每头牛每天吃 $1$ 千克,问距今天(即运来饲料 $f_2$ 千克的时间)最近的送饲料 $f_1$ 千克的时间是什么时候? ......
【计数,DP】ABC306Ex Balance Scale
[Problem Link](https://atcoder.jp/contests/abc306/tasks/abc306_h) 现在有 $n$ 个球,每个球有一个重量,重量未知。接下来会进行 $m$ 次称重,每次给定 $a_i$ 和 $b_i$,比较这两个球的重量,结果可能是 $>,=, 点击查 ......
P3089 [USACO13NOV] Pogo-Cow S 弹簧踩高跷
# P3089 [USACO13NOV] Pogo-Cow S 弹簧踩高跷 [洛谷题目传送门](https://www.luogu.com.cn/problem/P3089) [TOC] ## 题目描述 In an ill-conceived attempt to enhance the mobil ......
P3047 [USACO12FEB] Nearby Cows G
```cpp #include #include using namespace std; const int N = 100010,M = 30; int n,m; int w[N]; vector g[N]; int f[N][M],ans[N][M]; void DP1 (int u,int ......
P3134 [USACO16JAN] Lights Out G 关灯
# P3134 [USACO16JAN] Lights Out G 关灯 [TOC] [题目传送门洛谷链接](https://www.luogu.com.cn/problem/P3134) # [USACO16JAN] Lights Out G ## 题面翻译 ### 题目描述 Farmer Joh ......
P8903 [USACO22DEC] Bribing Friends G 看电影
# P8903 [USACO22DEC] Bribing Friends G 看电影 [TOC] [题目传送门](https://www.luogu.com.cn/problem/P8903) ## 题目描述 Bessie 想要观看纪录片:奶牛基因组学,但她不想一个人去。不幸的是,她的朋友们没有足够 ......
P3133 [USACO16JAN] Radio Contact G 无线电通话
# P3133 [USACO16JAN] Radio Contact G 无线电通话 [TOC] [题目传送门](https://www.luogu.com.cn/problem/P3133) ## [USACO16JAN] Radio Contact G ### 题目描述 Farmer John ......
【题解】#105. 「USACO1.3」Ski Course Design 题解(2023-07-01更新)
# #105. 「USACO1.3」Ski Course Design 题解 ## **[题目传送门](https://qoj.fzoi.top/problem/105)** **欢迎大家指出错误并联系这个蒟蒻** ## 更新日志 - **2023-02-01 17:20 文章完成** - **20 ......
【题解】#373. 「USACO1.1」Friday the Thirteenth 题解(2023-07-01更新)
# #373. 「USACO1.1」Friday the Thirteenth 题解 ## **[题目传送门](https://qoj.fzoi.top/problem/373)** **欢迎大家指出错误并联系这个蒟蒻** ## 更新日志 - **2023-02-01 17:20 文章完成** - ......
动态规划之 附录一:USACO中的背包问题
USACO是USA Computing Olympiad的简称,它组织了很多面向全球的计算机竞赛活动。 USACO Trainng是一个很适合初学者的题库,我认为它的特色是题目质量高,循序渐进,还配有不错的课文和题目分析。其中关于背包问题的那篇课文 (TEXT Knapsack Problems) ......
NC24727 [USACO 2010 Feb G]Slowing down
[题目链接](https://ac.nowcoder.com/acm/problem/24727) # 题目 **题目描述** Every day each of Farmer John's N (1 using namespace std; using ll = long long; templa ......
NC24141 [USACO 2011 Dec G]Grass Planting
[题目链接](https://ac.nowcoder.com/acm/problem/24141) # 题目 **题目描述** Farmer John has N barren pastures (2 using namespace std; using ll = long long; struct ......
NC24048 [USACO 2017 Jan P]Promotion Counting
[题目链接](https://ac.nowcoder.com/acm/problem/24048) # 题目 **题目描述** The cows have once again tried to form a startup company, failing to remember from pas ......
[USACO18DEC]Balance Beam P
# [USACO18DEC]Balance Beam P 热爱卡精度的你,为什么分数不取模? 既然不去模,那么拿到这个题先想想能不能乱搞过去。 设 $f_{i,j}$ 表示 $i$ 点出发至多走 $j$ 次的最优期望报酬。当 $j \rightarrow +\infty$ 时视为答案。转移为 $$ ......
[USACO1.3]混合牛奶 Mixing Milk
# [[USACO1.3]混合牛奶 Mixing Milk](https://www.luogu.com.cn/problem/P1208 "[USACO1.3]混合牛奶 Mixing Milk") ## 题目描述 由于乳制品产业利润很低,所以降低原材料(牛奶)价格就变得十分重要。帮助 Marry ......
Luogu P6191 [USACO09FEB]Bulls And Cows S (牡牛和牝牛)
# [USACO09FEB]Bulls And Cows S ## 题目背景 一年一度的展会要来临了,Farmer John 想要把 $N$($1 \leq N \leq 100,000$)只奶牛和公牛安排在单独的一行中。 John 发现最近公牛们非常好斗;假如两只公牛在这一行中靠的太近,他们就会吵 ......
P2860 [USACO06JAN]Redundant Paths G 题解 ratjan边双连通分量
题目链接:[https://www.luogu.com.cn/problem/P2860](https://www.luogu.com.cn/problem/P2860) 题目大意: 给定一个无向连通图,求至少加几条边,能使其变成一个边双连通图。 解题思路: 边双连通分量缩点后计算度数为 $1$ 的 ......
[USACO06FEB]Treats for the Cows G/S
# [[USACO06FEB]Treats for the Cows G/S](https://www.luogu.com.cn/problem/P2858 "[USACO06FEB]Treats for the Cows G/S") ## 题目描述 FJ has purchased N (1 us ......
Balanced Ternary String
给出一个长为n的只由'1','2','0'组成的字符串,要求改动最少的位置,使'1','2','0'的个数相同(保证n能被3整除),并使改动后的字符串字典序最小。 n不大于3∗105 贪心思路,从左向右大的变小的,从右向左小的变大的: #include<bits/stdc++.h> using na ......
Luogu P4824 [USACO15FEB] Censoring S
# [USACO15FEB] Censoring S ## 题面翻译 Farmer John为他的奶牛们订阅了Good Hooveskeeping杂志,因此他们在谷仓等待挤奶期间,可以有足够的文章可供阅读。不幸的是,最新一期的文章包含一篇关于如何烹制完美牛排的不恰当的文章,FJ不愿让他的奶牛们看到这 ......
Bull in a China Shop USACO - 640
题目链接:http://www.usaco.org/index.php?page=viewproblem2&cpid=640&lang=en 题意:有一个完整的图形被切分成k个碎片。在k个碎片中,一定有2个碎片可以正好拼成完整的图形。拼接时只能横向竖向移动碎片,并且碎片不能重叠。按顺序输出可以拼出完 ......
算法刷题记录:P1518 [USACO2.4]两只塔姆沃斯牛 The Tamworth Two
###题目链接: https://www.luogu.com.cn/problem/P1518 ###题目分析 这道模拟题很典型了,给定了一个**固定的移动方式,去模拟即可**, 该题说:如果牛和农夫永远不会相遇输出0,我没想到很好的方法,不推荐我这样的写法。 算勉强AC吧。 ###AC代码 ``` ......
Field Reduction USACO - 641
题目链接:http://www.usaco.org/index.php?page=viewproblem2&cpid=641&lang=en 题意:有n (3<n<50000) 头牛 你需要给这n头牛建造围栏。坐标范围1-40,000。围栏的面积越小越好。你需要删除1头牛来减小围栏面积 思路:1. ......
[刷题笔记] Luogu P3073 [USACO13FEB]Tractor S
[Problem](https://www.luogu.com.cn/problem/P3073) ### Solution 和[汽车拉力比赛](https://www.cnblogs.com/SXqwq/p/17455232.html)差不多,思路都是二分,二分$d$,但是汽车拉力比赛从一个路标开 ......
Luogu P3605 [USACO17JAN]Promotion Counting P
# [USACO17JAN]Promotion Counting P ## 题目描述 The cows have once again tried to form a startup company, failing to remember from past experience that cow ......
P2973 [USACO10HOL] Driving Out the Piggies G 臭气弹
[题目链接](https://www.luogu.com.cn/problem/P2973 "题目链接") 题目: 奶牛们建立了一个随机化的臭气炸弹来驱逐猪猡。猪猡的文明包含1到N (2 using namespace std; const int maxn=350; const int eps=1 ......