上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 35 下一页
摘要: 题: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 阅读全文
posted @ 2019-09-11 13:44 starve_to_death 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 题:https://www.luogu.org/problem/P2024 解析:https://blog.csdn.net/m0_37579232/article/details/79920785 #include<bits/stdc++.h> using namespace std; #defi 阅读全文
posted @ 2019-09-10 23:36 starve_to_death 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 题: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 阅读全文
posted @ 2019-09-10 22:23 starve_to_death 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 题:https://www.cometoj.com/problem/0221 #include<iostream> #include<cstring> #include<algorithm> #include<cstdio> #include<queue> using namespace std; 阅读全文
posted @ 2019-09-10 13:07 starve_to_death 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 题: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 阅读全文
posted @ 2019-09-09 22:41 starve_to_death 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 题:https://nanti.jisuanke.com/t/41349 分析:对于hero来说,走单源最短路,然后遍历dis数组中的最大值即可找到,对于消防员来说,走多源最短路,只需要建个超级起点连接各个消防点,边权为0走spfa即可出dis数组 注意:得无向边 #include<bits/std 阅读全文
posted @ 2019-09-08 21:58 starve_to_death 阅读(372) 评论(2) 推荐(0) 编辑
摘要: B题:https://nanti.jisuanke.com/t/41384 题意:俩操作,1操作:讲位置为x视为无效。2操作:询问以x位置为起点向后最近的有效位置。(起初全都有效) 分析:离散化+并查集,当一个位置无效时,2操作对他的询问就变成他的祖先,即找最近有效(找祖先) #include<bi 阅读全文
posted @ 2019-09-07 23:33 starve_to_death 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 题:https://www.luogu.org/problem/P3115 题意:给出起点A,终点B,N条路线,下面没俩行一个路线,第一行是俩个数,第一个为这条路线的花费,第二个为这条路线经过的点数n,第二行即为n个整数表示这条路径; 分析:1、题目有说如果要跳转航线就要花费被跳往航线的的费用,所以 阅读全文
posted @ 2019-09-04 23:41 starve_to_death 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 题意:给定一个无向图,删除某些边有一定的代价,要求删掉使得最短路径减小,求最小代价。 分析:首先要spfa求出起点到各个点的最短距离。对于一条权值为w,起点为i,终点为j的边,设dis[k]为起点到k点的距离,若dis[j]=dis[i]+w,则将该边加入另一个图里,边的容量为删除这条边的代价,则从 阅读全文
posted @ 2019-09-03 23:01 starve_to_death 阅读(141) 评论(0) 推荐(0) 编辑
摘要: priority_queue<int>que//默认最大的先出来 priority_queue<int,vector<int>,greater<int> >que;///最小的先出来 struct node{ int x,y; bool operator < (const node &b)const 阅读全文
posted @ 2019-09-02 23:18 starve_to_death 阅读(199) 评论(0) 推荐(1) 编辑
上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 35 下一页