从外面一点一点往里面拓展(floodfill),每次找出最小的一个点,计算它对答案的贡献就好了... 找最小的点的话,直接pq就行 /************************************************************** Problem: 1736 User: rausen Language: C++ Result: Accepted Time:196 ms Memory:2116 kb ***********************************…
1679: [Usaco2005 Jan]Moo Volume 牛的呼声 Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 723  Solved: 346[Submit][Status] Description Farmer John has received a noise complaint from his neighbor, Farmer Bob, stating that his cows are making too much noise.…
1677: [Usaco2005 Jan]Sumsets 求和 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 570  Solved: 310[Submit][Status] Description Farmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers th…
完全背包.. --------------------------------------------------------------------------------------- #include<cstdio> #include<algorithm> #include<cstring> #include<iostream>   #define rep( i , n ) for( int i = 0 ; i < n ; i++ ) #defi…
一开始直接 O( n² ) 暴力..结果就 A 了... USACO 数据是有多弱 = = 先sort , 然后自己再YY一下就能想出来...具体看code ----------------------------------------------------------------------------------------- #include<cstdio> #include<algorithm> #include<cstring> #include<i…
题目 1677: [Usaco2005 Jan]Sumsets 求和 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 617  Solved: 344[Submit][Status] Description Farmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers…
1677: [Usaco2005 Jan]Sumsets 求和 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 626  Solved: 348[Submit][Status] Description Farmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers th…
链接 1735: [Usaco2005 jan]Muddy Fields 泥泞的牧场 思路 这就是个上一篇的稍微麻烦版(是变脸版,其实没麻烦) 用边长为1的模板覆盖地图上的没有长草的土地,不能覆盖草地 每个点(x,y)只有选择x或者y才能被覆盖 还是最小点覆盖,证明在上一篇 横边和竖边得遍历一遍求出,因为不能越过草地嘛 然后左边横边,右边竖边,开心的跑最大流就可以 代码 #include <bits/stdc++.h> #define iter vector<int>::itera…
... #include <iostream> using namespace std; ]; int n,i; int main() { cin>>n; f[]=; ;i<=n;i++) { f[i]=f[i-]; )) f[i]+=f[i/]; f[i]%=; } cout<<f[n]; ; } Description Farmer John commanded his cows to search for different sets of numbers…
断环然后裸DP就好了... $f[i][j][k]$表示1号时间段没有被算入答案,到了第$i$个时间段,一共选了$j$个时间段,$k = 0 /1$表示第i个时间段有没有被算进答案的最优值 $g[i][j][k]$表示1号时间段被算入答案,到了第$i$个时间段,一共选了$j$个时间段,$k = 0 /1$表示第i个时间段有没有被算进答案的最优值,则$g$必须要选最后一个时间段 转移的时候直接枚举最后一个时间段又没有被算进答案就好了...方程看程序好了.. /*******************…