上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 28 下一页
摘要: 费用流Orz 懒癌发作复制了个mcf的模板 然后那个模板建边cost是不取反的,因此出现了负环,spfa出不来了,调试到心态爆炸Orz 建模:每个点向与它有相连的点连一条边权为1,cost为v的边,表示一个物品可取一次,再连一条边权inf,cost为0的边。 读题大赛,出题人语文水平堪忧。 cpp 阅读全文
posted @ 2018-07-08 11:58 SWHsz 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 在tyvj上怀疑爆栈了.....~~或许~~一定是我写挂了。以后调吧。。。 UPD:bzoj上过了。。。 题解:https://blog.csdn.net/popoqqq/article/details/39965603 po姐太神了! cpp include include include inc 阅读全文
posted @ 2018-07-08 10:23 SWHsz 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 突然发现这个自己还不会。。。 其实也不难,就和快速幂感觉很像,把物品数量二进制拆分一下,01背包即可 我是咸鱼 cpp include include include using namespace std; int a[7],ave,sum; bool f[120005]; void bag01( 阅读全文
posted @ 2018-07-08 08:55 SWHsz 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 做克鲁斯卡尔的时候维护一个并查集即可。 cpp include include include include using namespace std; const int N= 6010; int T; struct Edge { int x,y,val; } e[N]; bool operato 阅读全文
posted @ 2018-07-08 02:04 SWHsz 阅读(321) 评论(0) 推荐(0) 编辑
摘要: 滚动数组优化一波。 原设计状态:表示三个员工分别的位置和执行到的任务。 考虑到:执行完第i个任务,一定有员工在pos[i],那么就可以压一维,空间复杂度就算不滚动数组也可以了。 (喜闻乐见,~~今天~~第一次)1A cpp include include include using namespac 阅读全文
posted @ 2018-07-08 01:14 SWHsz 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 对的$n^3$的程序调了一个月了,惊了。。。 HSZ学oi$\Longleftrightarrow$闭眼学oi 要不是翻旧账还看不见。。 这是有$n^2$做法的。 参见LYD的书P244 cpp include include include include include include defi 阅读全文
posted @ 2018-07-08 00:25 SWHsz 阅读(131) 评论(0) 推荐(0) 编辑
摘要: LCIS模板 cpp include include include using namespace std; int n; long long a[3005],b[3005],f[3005]; int main() { scanf("%d",&n); for(int i=1; ib[j]&&f[j 阅读全文
posted @ 2018-07-07 23:53 SWHsz 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 歪解:爆空间的DP cpp //Writer:jr HSZ;%%%WJMZBMR include include include define LL long long define reg register int define f(i,a,b) for(reg i=a;i include lon 阅读全文
posted @ 2018-07-07 23:14 SWHsz 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 巨坑 树剖学的好啊! sfailsth 把一段路径拆成两段,向上和S LCA,向下LCA T 用维护重链什么的操作搞一下。 sfailsth学长真不容易啊。。。考场上rush了4.58KB代码。。。。 常数巨大懒得优化,最慢一个点1528ms/128703KB,Orz cpp include inc 阅读全文
posted @ 2018-07-07 21:27 SWHsz 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 本来用vector写的,结果T了,您还卡常啊.... 这类题叫同余类bfs,因为h太大了,我们不可能枚举(雾) 把h层弄成膜a下剩余系,然后向每个剩余系(x+b)%a连权为b的边,(x+c)%a连权c的边,spfa一发,然后随便搞一下。 long long! cpp include include 阅读全文
posted @ 2018-07-07 00:29 SWHsz 阅读(185) 评论(0) 推荐(0) 编辑
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 28 下一页