摘要:
找某个区间内的最大最小值; 思想:动态规划 用f【i】【j】表示以第i个数为起点,往后连续2^j个数中的最大值; log数组向下取整; code: #include<bits/stdc++.h> using namespace std; typedef long long ll; const int 阅读全文
摘要:
#include<iostream> #include<cstdio> #include<queue> #include<cstring> #include<algorithm> typedef long long LL; using namespace std; LL RD(){ LL out = 阅读全文
摘要:
dfs序就是一棵树在dfs遍历时组成的节点序列.(先序遍历差不多),dfs序把一棵树进行区间化 出入的区间就是它掌控的子树,出入分别即为in[x],out[x],in[x]为结点x进入时的时间戳,out[x]为结点x出去时的时间戳 比如上图子树,dfs序为,A B E E F K K F B C G 阅读全文
摘要:
链接: 题意:给一个01串,可以交换相邻两个的位置k次问字典序最小的序列; 简单的贪心题,每次考虑把最小的往前放,最小只有零,找一下交换的代价即可; code; #include<bits/stdc++.h> using namespace std; const int maxn=10010; vo 阅读全文