随笔分类 -  洛谷OJ

1
摘要:link #include <iostream> #include <vector> #include <algorithm> #include <unordered_set> #include <cstring> #include <queue> #include <stack> # define 阅读全文
posted @ 2020-06-20 17:42 feibilun 阅读(95) 评论(0) 推荐(0)
摘要:link 题解: 参考 https://www.luogu.com.cn/blog/12cow/SBCOI2020 从i到i-1,dp[k+1][j]与dp[i][k]交点左移,deque后端pop,需要多考虑i-1这个点,比较后加到deque前端。 #include <bits/stdc++.h> 阅读全文
posted @ 2020-05-19 08:17 feibilun 阅读(143) 评论(0) 推荐(0)
摘要:link #include <bits/stdc++.h> # define LL long long using namespace std; struct Edge{ int to; int next; }e1[500010], e2[500010]; int head1[100010]; in 阅读全文
posted @ 2020-05-18 11:02 feibilun 阅读(182) 评论(0) 推荐(0)
摘要:link 题解可参考:https://www.luogu.com.cn/blog/cicos/solution-p2613# int a,b; const int mod=19260817; int x,y; int getint(){ char c=getchar(); int res=0; wh 阅读全文
posted @ 2020-03-29 17:37 feibilun 阅读(150) 评论(0) 推荐(0)
摘要:link 题解可参考:https://www.luogu.com.cn/blog/cicos/solution-p1082# #include <bits/stdc++.h> # define LL long long using namespace std; LL a,b; LL x,y; voi 阅读全文
posted @ 2020-03-29 17:11 feibilun 阅读(114) 评论(0) 推荐(0)
摘要:link int sum[220][220]; int mi[220][220]; int ma[220][220]; int p[220]; int main(){ int N; cin>>N; for(int i=1;i<=N;i++){ scanf("%d", p+i); p[i+N]=p[i 阅读全文
posted @ 2020-03-22 18:19 feibilun 阅读(137) 评论(0) 推荐(0)
摘要:#include <iostream> #include <algorithm> # define LL long long using namespace std; const int maxn=11000002; char data[maxn<<1]; int len[maxn<<1]; int 阅读全文
posted @ 2020-03-14 21:15 feibilun 阅读(144) 评论(0) 推荐(0)
摘要:Link Solution: f[i][j]= 1 if i cats can make up j blood. f[0][0]=1 #include <bits/stdc++.h> # define LL long long using namespace std; int n; int a[21 阅读全文
posted @ 2020-02-14 18:18 feibilun 阅读(181) 评论(0) 推荐(0)
摘要:Link Solution: Get the posistions of numbers of P2 in P1, find the LIS in this position array. #include <bits/stdc++.h> # define LL long long using na 阅读全文
posted @ 2020-02-14 10:49 feibilun 阅读(93) 评论(0) 推荐(0)
摘要:Link Solution: ans=sum of total triangles - sum of triangles with different colors Define the angle with different edge as D-angle. Consider triangles 阅读全文
posted @ 2020-02-11 12:23 feibilun 阅读(323) 评论(1) 推荐(0)
摘要:题目链接 题解: 先用所有的边生成一棵最小生成树,然后从后往前不断删边,看此边有没有用到,用到的话重新跑生成树,没有的话结果不变。还是Kruskal方便些。。。 Prime: #include <bits/stdc++.h> # define LL long long using namespace 阅读全文
posted @ 2020-02-06 12:32 feibilun 阅读(140) 评论(0) 推荐(0)
摘要:题目链接 题解: 每一个子连通图,对它进行黑白染色,然后取两种染色中的最小值,然后最后汇总。 #include <bits/stdc++.h> # define LL long long using namespace std; const int maxn=10000+10; const int 阅读全文
posted @ 2020-02-05 17:34 feibilun 阅读(132) 评论(0) 推荐(0)
摘要:题目链接 解法: 栈 1 #include <bits/stdc++.h> 2 # define LL long long 3 using namespace std; 4 5 const int mod=10007; 6 stack<char> ope; 7 stack<int> one; 8 s 阅读全文
posted @ 2020-02-04 15:08 feibilun 阅读(181) 评论(0) 推荐(0)
摘要:题目链接 1 #include <bits/stdc++.h> 2 # define LL long long 3 using namespace std; 4 5 const int maxn=5000+10; 6 int n; 7 LL dis[maxn]; 8 int complete[max 阅读全文
posted @ 2020-02-04 09:13 feibilun 阅读(210) 评论(0) 推荐(0)
摘要:题目链接 题解: 对每种主件的 附件的集合 进行一次 01 背包处理,就可以先求出 对于每一种主件包括其附件的组合中,每种花费的最大价值,对应不同的方案。 在对主件进行背包处理。 需要注意的是在对每个主件的附件进行处理时,要恰好花完价钱,否则方案数会非常多。 Code: 1 #include <bi 阅读全文
posted @ 2020-02-01 17:59 feibilun 阅读(148) 评论(0) 推荐(0)
摘要:题目链接 题解: copy from: https://www.luogu.com.cn/blog/ryoku/ryoku-di-xin-nian-huan-le-sai-ti-xie segment tree, seg[i]为区间元素个数,每次从剩下的数中找第(b[i]+1)小的数,然后去掉次数( 阅读全文
posted @ 2020-02-01 10:09 feibilun 阅读(228) 评论(0) 推荐(0)
摘要:题目链接 题解: 图为一个基环树。 dfs找到环,对于环上的每一个点u, 确定与它连接的具有最小美观度的边的长度w, 把这个w值更新到与它连接的其他非环上点(minval[]数组),则u和与它连接的其他非环上点的答案即为所有边长度只和减去minval[i]。 Code: 1 #include <bi 阅读全文
posted @ 2020-01-31 19:49 feibilun 阅读(210) 评论(0) 推荐(0)
摘要:题目链接 解法: 初始n个节点,n颗树,每连一条边,减少一棵树。k棵树需要连n-k条边。。。1棵树需要连n-1条边。。。 给每条可以连的边按代价从小到大排个序,然后连n-k条边造k个最小生成树就可以了。 Code: 1 #include <bits/stdc++.h> 2 # define LL l 阅读全文
posted @ 2020-01-31 17:54 feibilun 阅读(136) 评论(0) 推荐(0)
摘要:题目链接 解法参见:https://www.luogu.com.cn/blog/cicos/solution-p2774# Code: 1 #include <bits/stdc++.h> 2 #define LL long long 3 #define INF 0x3f3f3f3f; 4 usin 阅读全文
posted @ 2020-01-31 16:25 feibilun 阅读(155) 评论(0) 推荐(0)
摘要:题目链接 方法1: bfs Code: #include <bits/stdc++.h> # define LL long long using namespace std; const int maxn=1000000+10; int N,M; vector<int> adj[maxn]; int 阅读全文
posted @ 2020-01-31 15:01 feibilun 阅读(193) 评论(0) 推荐(0)

1