09 2019 档案
摘要:题:https://www.cometoj.com/problem/0461 分析:求边双,最后求多汇点最长路 #include<iostream> #include<cstring> #include<algorithm> #include<cstdio> #include<vector> #in
阅读全文
摘要:题意:选俩条除起点终点(1为起点,n为终点),所经过互不相交的路径,并要求最小cost 分析:很明显的最小费用最大流问题,最大流为路径数时2, 经验:要熟悉这种题型:“互不相交的路径”可以望网络流方向思考 #include<bits/stdc++.h> using namespace std; co
阅读全文
摘要:题意:类似二分图匹配给的题目,不过这次在这里给出了k,表示没人可以再多一次匹配机会,这次匹配不能用上一次被匹配的对象 分析:不能用匈牙利做俩次匹配,因为俩次的最大匹配并不等价于总和的匹配,事实证明,你用俩次匹配后会被卡在17个样例 既然二分图不能用匈牙利,那么只能考虑用网络流,这里讲到对于k的处理,
阅读全文
摘要:题:http://acm.hdu.edu.cn/showproblem.php?pid=6736 题意:删掉一些边使得图不存在点双,求方案数。 分析:若一条边不属于点双,那么这条边有删和不删俩种选择,若找到点双,点双中必须删掉一条边(题目有保证一条边只能属于一个点双,所以不用担心一条边用于多个点双)
阅读全文
摘要:学习粗:https://blog.csdn.net/ddelphine/article/details/77935670 模板题:http://poj.org/problem?id=2914 #include <iostream> #include<cstring> using namespace
阅读全文
摘要:题:http://codeforces.com/contest/1216/problem/F dp[i][0]:表示第i个位置不装的最小代价 dp[i][1]:表示第i个位置装的最小代价 T1的线段树是维护装的最小代价 T2的线段树是维护装和不装的最小代价 #include<bits/stdc++.
阅读全文
摘要:poj1741 题:http://poj.org/problem?id=1741 题意:给定树,和一个树k,问有多少个点对之间的路径是不超过k #include<iostream> #include<algorithm> #include<cstdio> #include<cstring> usin
阅读全文
摘要:题: https://nanti.jisuanke.com/t/41414 #include<bits/stdc++.h> using namespace std; typedef __int128 ll; const int M=30; const int mod=1e9+7; ll dp[M][
阅读全文
摘要:题:https://nanti.jisuanke.com/t/41420 定义 dp[x][y] 表示第 x 个数到最后一个数能组成和为 y 的方案数 #include<bits/stdc++.h> using namespace std; typedef long long ll; const i
阅读全文
摘要:题:https://nanti.jisuanke.com/t/41403 题意:求任意俩点之间距离之和模3后的三个结果的总数(原距离之和) 第一种做法: 树形dp #include<bits/stdc++.h> using namespace std; #define pb push_back ty
阅读全文
摘要:基础(据说):基数排序:https://blog.csdn.net/zhen921/article/details/80354096 模板题:https://www.luogu.org/problem/P3809 学习粗:https://www.cnblogs.com/chenxiaoran666/
阅读全文
摘要:长文章:https://www.cnblogs.com/ZuoAndFutureGirl/p/9028287.html 板题:求子串在主串中出现的次数 #include<bits/stdc++.h> using namespace std; const int M=1e6+6; char S[M],
阅读全文
摘要:题:https://www.luogu.org/problem/P2221#submit 求:ans=i=l∑ra[i]∗(r−i+1)(i−l+1) #include<bits/stdc++.h> using namespace std; typedef long long ll; #defin
阅读全文
摘要:题:https://www.cometoj.com/problem/1046 #include<bits/stdc++.h> using namespace std; typedef long long ll; struct node{ int id,daoda,xiaohao,val; bool
阅读全文
摘要:题:https://www.luogu.org/problem/P2024 解析:https://blog.csdn.net/m0_37579232/article/details/79920785 #include<bits/stdc++.h> using namespace std; #defi
阅读全文
摘要:题:https://www.cometoj.com/problem/0073 #include<bits/stdc++.h> using namespace std; const int M=1e5+4; struct node{ int u,v,w; }e[M]; int f[M]; bool c
阅读全文
摘要:题:https://www.cometoj.com/problem/0221 #include<iostream> #include<cstring> #include<algorithm> #include<cstdio> #include<queue> using namespace std;
阅读全文
摘要:题:https://nanti.jisuanke.com/t/41350 分析:先将字符串转置过来 状态转移,因为只有5个状态,所以 i 状态到 j 状态的最小代价就枚举【i】【k】->【k】【j】的最小值(0<=k<=4) 0:初始状态 1:2 2:20 3:201 4:2019 mat[i][j
阅读全文
摘要:题:https://nanti.jisuanke.com/t/41349 分析:对于hero来说,走单源最短路,然后遍历dis数组中的最大值即可找到,对于消防员来说,走多源最短路,只需要建个超级起点连接各个消防点,边权为0走spfa即可出dis数组 注意:得无向边 #include<bits/std
阅读全文
摘要:B题:https://nanti.jisuanke.com/t/41384 题意:俩操作,1操作:讲位置为x视为无效。2操作:询问以x位置为起点向后最近的有效位置。(起初全都有效) 分析:离散化+并查集,当一个位置无效时,2操作对他的询问就变成他的祖先,即找最近有效(找祖先) #include<bi
阅读全文
摘要:题:https://www.luogu.org/problem/P3115 题意:给出起点A,终点B,N条路线,下面没俩行一个路线,第一行是俩个数,第一个为这条路线的花费,第二个为这条路线经过的点数n,第二行即为n个整数表示这条路径; 分析:1、题目有说如果要跳转航线就要花费被跳往航线的的费用,所以
阅读全文
摘要:题意:给定一个无向图,删除某些边有一定的代价,要求删掉使得最短路径减小,求最小代价。 分析:首先要spfa求出起点到各个点的最短距离。对于一条权值为w,起点为i,终点为j的边,设dis[k]为起点到k点的距离,若dis[j]=dis[i]+w,则将该边加入另一个图里,边的容量为删除这条边的代价,则从
阅读全文
摘要:priority_queue<int>que//默认最大的先出来 priority_queue<int,vector<int>,greater<int> >que;///最小的先出来 struct node{ int x,y; bool operator < (const node &b)const
阅读全文
摘要:https://nanti.jisuanke.com/t/41299 分析:题目给出a,b,mod求满足条件的最小a,由题目的式子得,每次只要能递归下去,b就会+1,所以就可以认为b其实是次数,什么的次数?对数函数的反函数。。。。即题目求a的a次方的a次方.....一直搞b次后求得的答案。 #inc
阅读全文
摘要:在数论中,欧拉定理,(也称费马-欧拉定理)是一个关于同余的性质定理。了解欧拉定理之前先来看一下费马小定理: a是不能被质数p整除的正整数,则有a^(p-1) ≡ 1 (mod p) 欧拉给出了推广形式 若n,a为正整数且互质,则,其中φ(n)表示小于等于n的数中与n互质的数的数目。可以看出费马小定理
阅读全文

浙公网安备 33010602011771号