摘要: Jisoo 首先呢,可以知道,每个数都要去它右边第一个空位置 然后对于$a_i,a_j$,假如$b_i,b_j$是空位的话,那么无论$a_i,a_j$谁去哪里,总距离不变 那么显然让每一个数去它右边的第一空是最有的(拉开距离差距) 然后按照距离分配b #include<iostream> #incl 阅读全文
posted @ 2021-09-14 23:01 Simex 阅读(78) 评论(0) 推荐(0) 编辑
摘要: Jisoo $dp_i$表示节点i为头的最长毛毛虫 (我这里i的父节点呗算作腿的一条) 然后就可以不用特判地进行转移 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #define int long 阅读全文
posted @ 2021-09-14 22:55 Simex 阅读(25) 评论(0) 推荐(0) 编辑
摘要: Jisoo 这种背包是不是把一维扔进状态就都能做了啊 $dp_{i,j}$表示到了第i个任务的时候A机器工作了j时间,转移显然 有点卡时间,注意常数优化 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> 阅读全文
posted @ 2021-09-14 22:52 Simex 阅读(33) 评论(0) 推荐(0) 编辑
摘要: Jisoo 显然找硬币和付钱是两个过程 然而最多给多少钱呢 有应该找最多多多少呢? 方案一 时间绰绰有余,我们开的大一点 证明 找钱的数量不会超过$V_{max}^2$ #include<iostream> #include<cstdio> #include<algorithm> #include< 阅读全文
posted @ 2021-09-14 22:50 Simex 阅读(44) 评论(0) 推荐(0) 编辑