摘要:
莫队有一种暴力的美感,它只是通过分块降低了暴力做法的复杂度 #include<bits/stdc++.h> using namespace std; const int N = 5e4 + 5; long long ans, out[N], n, m, k, a[N], b[N], tong[N]; 阅读全文
摘要:
#include<bits/stdc++.h> using namespace std; const int L = 105; const int mod = 1e4 + 7; int n, m, cnt, ans = 1, tr[L * 60][30], fail[L * 60], dp[L][L 阅读全文
摘要:
能自动AC的机器(不是 简单版 #include<bits/stdc++.h> using namespace std; const int N = 1e6 + 5; int n, cnt, ans, fail[N], tr[N][30], flag[N]; string s, t; queue<i 阅读全文
摘要:
一个贪心算法,先排序,然后从小到大开始选边; 同时用并查集来维护两个点是否连通,如果当前边连接的两个点已经连通,那么说明选这条边没有任何意义,一定是劣的(因为前面已经排了序) #include<bits/stdc++.h> using namespace std; const int N = 500 阅读全文
摘要:
单点修改,区间查询树状数组,洛谷P3374 #include<bits/stdc++.h> using namespace std; const int N = 5e5 + 5; int n, m, a[N]; int chaxun(int n){ int ans = 0; while(1){ an 阅读全文
摘要:
边双连通分量:模板 #include<bits/stdc++.h> using namespace std; const int N = 5e5+5; int n, m, cnt, ans, dfn[N], low[N]; //dfn记录dfs序,low表示这个点除树边外能连到最浅 vector<i 阅读全文