随笔分类 -  洛谷

上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 21 下一页
摘要:[Archie]([P1006 NOIP2008 提高组] 传纸条 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)) 一步一步的走有点烦,何不走两步一次 #include<iostream> #include<cstdio> #include<algorithm> using na 阅读全文
posted @ 2021-07-11 08:56 Simex 阅读(85) 评论(0) 推荐(0)
摘要:Archie 很简单的小模拟 我们把每四位数和一个:作为一段进行处理 小小的特判 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; string s; int a[9]; int main(){ 阅读全文
posted @ 2021-07-11 08:12 Simex 阅读(208) 评论(0) 推荐(0)
摘要:sczyyds sczyyds sczyyds I can't forget 你需要知道怎么求位数 #include<cmath> #include<cstdio> #include<iostream> #define ll long long using namespace std; ll n; 阅读全文
posted @ 2021-07-10 11:47 Simex 阅读(34) 评论(0) 推荐(0)
摘要:FOGGY 记忆化搜索 改变每一个叶子节点,它的影响是线性的往根节点走 也就是说,如果一个父节点在这条路径上改变了,并且这种改变会影响到根节点那么应该标记, 同理,没有影响的改变 也就是说,标记某个节点的改变的影响 那么怎么具体搞呢 对于每一种操作,单独分析 \(O(n^2)\) #include< 阅读全文
posted @ 2021-07-07 21:45 Simex 阅读(33) 评论(0) 推荐(0)
摘要:Aimee 很显然,对于每一行来讲,如果他们$gcd(x,y)$不为1,那么这个斜率一定出现过,所以说呢,需要排除 再结合一下对称性,可以知道对于每一列,可用的点对就是$\psi(x)$ 最后的答案就是$3+2*\sum_{i=2}^{n-1}\psi(i)$ 为什么是n-1呢,因为体委再(1,1) 阅读全文
posted @ 2021-06-20 17:24 Simex 阅读(92) 评论(0) 推荐(0)
摘要:Aimee 按照依赖顺序建图后,显然可以发现一个递推的关系,如果一个点入度为零,那么它就可以完成 这样从入度为零的点开始更新,删边,并且在度数又为零后加入待处理的队列 #include<iostream> #include<cstdio> #include<algorithm> #include<q 阅读全文
posted @ 2021-06-03 14:34 Simex 阅读(88) 评论(0) 推荐(0)
摘要:Aimee "Doctor,你觉得问题在哪" "就在这里" 不能摘得桃树没有意义,一次摘得消耗是一样得,而且把时间和体力的消耗是一样的,那么也不用开二维了,记得给他留一点体力就可以了 剩下的就是个多重背包 # include<iostream> #include<cstdio> #include<c 阅读全文
posted @ 2021-05-30 21:24 Simex 阅读(79) 评论(0) 推荐(0)
摘要:Aimee "Doctor,你这水平下降的有点。。。" '"我怎么知道能手残写了个return p" 很显然,那条路径一定在最大生成树上,然后在这条树上跑LCA即可 #include<iostream> #include<cstdio> #include<algorithm> #include<cs 阅读全文
posted @ 2021-05-30 20:06 Simex 阅读(47) 评论(0) 推荐(0)
摘要:❤Aimee❤ 和普通的最短路相比,多了一个免费边的限制 可以考虑得到,如果没有免费边的话,其实也就都一样了,那么考虑只有一个免费边 我们使用了之后,是不是就相当与进入了一个新的(没有边可以免费的)图,在这张图上,就和原来一样跑最短路就可以了 推而广之,结合一下dp的思想,可以把图分成$k$层,每用 阅读全文
posted @ 2021-05-17 17:11 Simex 阅读(46) 评论(0) 推荐(0)
摘要:Aimee 模拟即可 #include<iostream> #include<algorithm> #include<cstring> #include<cstdio> using namespace std; int n,m,k,p; int a[110001]; int b[110001]; s 阅读全文
posted @ 2021-05-09 21:12 Simex 阅读(209) 评论(0) 推荐(0)
摘要:Aimee 看起来就是个匹配问题 建模 超级源点和汇点是必须的,那么这样看来,我们把每个单位和每张桌子连一张容量为1的边,表示只能派一个人,超级源点和每个单位连对应人数的边,桌子同理,然后跑最大流并且检查最大流和人数就可以 #include<iostream> #include<cstdio> #i 阅读全文
posted @ 2021-05-09 20:02 Simex 阅读(43) 评论(0) 推荐(0)
摘要:Aimee 首先可以知道对于任意一个$a_i$,我们可以知道他的贡献在$[i,n]$ 那么对于每一次对于$ss_k$的查询,贡献是$(k-i+1)*a_i$ 分配一下,贡献是$a_i*(k+1)+a_i$,分别计算这两个就可以了 #include<iostream> #include<cstdio> 阅读全文
posted @ 2021-04-18 17:43 Simex 阅读(50) 评论(0) 推荐(0)
摘要:Aimee 应该用线段树的,但是用树状数组就行 反正开方这个东西只能单点修改 最后用并查集优化一下 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> #define in 阅读全文
posted @ 2021-03-28 20:29 Simex 阅读(48) 评论(0) 推荐(0)
摘要:Aimee 这是一道分块好题 显然我们要分块,一开始我们要建立分块,在这里我们要统计的数据有:原序列,每个元素属于哪一个块,每一个块的左右边界,每一个块的lazy,块的总数。 由于这个题目的要求,我们还需要建立一个复制的块来排序,进行查询。 最后不成块元素单独成块。 void build() { b 阅读全文
posted @ 2021-03-28 17:33 Simex 阅读(63) 评论(0) 推荐(0)
摘要:Miku 悬线法: 对于每一个点,我们以这个点为矩形的最低点,然后向左右检查最大扩展位置,然后向上找在此情况下的最大高度 #include<cstdio> #include<algorithm> #include<cstring> #include<iostream> using namespace 阅读全文
posted @ 2021-03-14 14:45 Simex 阅读(76) 评论(0) 推荐(0)
摘要:Aimee 显然是可以继承的 #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<string> #include<algorithm> #include<cmath> using name 阅读全文
posted @ 2021-03-14 11:06 Simex 阅读(50) 评论(0) 推荐(0)
摘要:Aimee 因为可以堵出口和入口,所以只有 \({1,2,3}\) 那么先dfs一遍并且封锁路径,然后再dfs一遍 #include<iostream> #include<cstdio> #include<algorithm> #include<cstdio> #include<vector> us 阅读全文
posted @ 2021-03-07 21:41 Simex 阅读(61) 评论(0) 推荐(0)
摘要:[Aimee](P1855 榨取kkksc03) 很简单的dp #include<iostream> #include<cstring> using namespace std; int n,m,t; int mi[1000]; int ti[1000]; int dp[201][301][201] 阅读全文
posted @ 2021-03-07 11:26 Simex 阅读(77) 评论(0) 推荐(0)
摘要:[Aimee](https://www.luogu.com.cn/problem/P1474) 显然是个背包 #include<iostream> #include<cstdio> #define int long long using namespace std; int n,v; int f[1 阅读全文
posted @ 2021-02-24 10:34 Simex 阅读(65) 评论(0) 推荐(0)
摘要:Aimee 非常显然 #include<iostream> #include<cstring> using namespace std; int n; int h[1000001]; long long dp[1000001][2]; int main(){ cin>>n; memset(dp,0x 阅读全文
posted @ 2021-02-23 15:33 Simex 阅读(65) 评论(0) 推荐(0)

上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 21 下一页