摘要:
题目传送门:https://www.luogu.com.cn/problem/P3379 倍增LCA模板: 1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #include<vector> 5 #include<map> 阅读全文
摘要:
题目传送门:https://www.luogu.com.cn/problem/P3382 模板: 1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #include<vector> 5 #include<map> 6 #i 阅读全文
摘要:
题目传送门:https://www.luogu.com.cn/problem/P4017 代码: 1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #include<vector> 5 #include<map> 6 #i 阅读全文
摘要:
题目传送门:http://poj.org/problem?id=3580 题意:有一个序列,有6种操作: ADD x y D:将x-y区间内的值全部加D,例如,将区间{1, 2, 3, 4, 5} 2-4 全部+1 得到 {1, 3, 4, 5, 5} REVERSE x y: 将x-y区间内的值全 阅读全文
摘要:
题目传送门:https://codeforces.com/problemset/problem/420/D 题意:给出m次操作,每次操作输入两个值x,y,将y位置值为x的数移到最前面,让你求一个长度为n的初始序列满足所要进行操作的条件。 思路:由于初始序列未知,我们可以将序列都设为0,然后按操作进行 阅读全文
摘要:
题目传送门:https://codeforces.com/problemset/problem/527/C 题意:给出一个面积为h×w的长方形,有m次操作,每次操作可以横着或竖着在某个位置砍一刀,问你在m次操作后,在所有块中面积最大的一个。 思路:理解题意,就是让你求砍m次后,剩下的部分的最长的高和 阅读全文
摘要:
题目传送门:https://www.luogu.com.cn/problem/P3369 模板: 1 #include<cstdio> 2 #include<cstring> 3 #include<cstdlib> 4 #include<iostream> 5 using namespace std 阅读全文
摘要:
题目链接:https://codeforces.com/contest/718/problem/C 题意:给出一个序列,有两种操作,操作一:将序列中l-r部分的值加上某个数,操作二:计算Σri=lf(i) 的值第l-r项斐波那契数的和。 思路:首先我们需要解决的问题是计算第n项斐波那契数的值,n的范 阅读全文
摘要:
demo: 1 #include<iostream> 2 #include<algorithm> 3 #include<cmath> 4 #include<cstring> 5 #include<queue> 6 #include<cstdio> 7 #define LL long long 8 u 阅读全文
摘要:
洛谷模板题:https://www.luogu.com.cn/problem/P4799 ac代码: 时间复杂度: 1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #include<vector> 5 #include< 阅读全文