随笔分类 -  训练

1
摘要:题:https://codeforces.com/contest/1304/problem/D 题意:给定长度为n-1的只含’>'和‘<’的字符串,让你构造出俩个排列,俩个排列相邻的数字之间要满足这个字符串,找出的俩个要是最小化最长上升子序列,和最大化最长上升子序列; 分析:dilworld定理,最 阅读全文
posted @ 2020-02-19 16:26 starve_to_death 阅读(115) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2020-02-14 14:12 starve_to_death 阅读(0) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2020-02-10 00:38 starve_to_death 阅读(1) 评论(0) 推荐(0)
摘要:题:https://codeforces.com/problemset/problem/977/E 题意:给你一个图,问你有几个没有杂边的单环(度全为2) 分析:单环点的度数一定是2,连续边,判断是否连通,如果连通,ans++,否则连接这个边 #include<bits/stdc++.h> usin 阅读全文
posted @ 2020-02-04 00:29 starve_to_death 阅读(226) 评论(0) 推荐(0)
摘要:题:https://codeforces.com/contest/1285/problem/E 题意:给定n个区间,最多删除一个区间,让最后的并区间个数最大 #include<bits/stdc++.h> using namespace std; const int M=4e5+5; pair<in 阅读全文
posted @ 2020-01-17 22:00 starve_to_death 阅读(329) 评论(0) 推荐(0)
摘要:题:https://ac.nowcoder.com/acm/contest/888/C #include<bits/stdc++.h> using namespace std; const int M=2e3+3; int n,A[M][M]; void dfs(int x){ if(x==1){ 阅读全文
posted @ 2019-12-08 10:32 starve_to_death 阅读(152) 评论(0) 推荐(0)
摘要:题源:https://codeforces.com/gym/101635/attachments 题意: n行,每行给定字符串s1,s2,s3代表一些菜谱名。s2和s3是煮成是的必要条件,然后给出c和v,分别代表s1的消耗和收获; (注意:这个消耗并不可能是s1的真正消耗和收获,s1的最后消耗和收获 阅读全文
posted @ 2019-11-30 22:17 starve_to_death 阅读(210) 评论(0) 推荐(0)
摘要:学习:https://blog.csdn.net/qq_21334057/article/details/99550805 题意:从n个点中选择k个点构成多边形,问期望面积。 题解:如果能够确定两个点,那么可以从这两个点之间选择k−2个点来构成一个k边形。所以可以枚举两个点,计算这两个点被选入构成凸 阅读全文
posted @ 2019-10-03 16:07 starve_to_death 阅读(334) 评论(0) 推荐(0)
摘要:题意:右下脚位置和其他位置不同 https://ac.nowcoder.com/acm/contest/888/C #include<bits/stdc++.h> using namespace std; const int M=2e3+3; int n,A[M][M]; void dfs(int 阅读全文
posted @ 2019-10-01 22:23 starve_to_death 阅读(135) 评论(0) 推荐(0)
摘要:题:http://acm.hdu.edu.cn/showproblem.php?pid=6736 题意:删掉一些边使得图不存在点双,求方案数。 分析:若一条边不属于点双,那么这条边有删和不删俩种选择,若找到点双,点双中必须删掉一条边(题目有保证一条边只能属于一个点双,所以不用担心一条边用于多个点双) 阅读全文
posted @ 2019-09-29 20:40 starve_to_death 阅读(377) 评论(0) 推荐(0)
摘要:题: 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][ 阅读全文
posted @ 2019-09-15 23:49 starve_to_death 阅读(159) 评论(0) 推荐(0)
摘要:题:https://nanti.jisuanke.com/t/41420 定义 dp[x][y] 表示第 x 个数到最后一个数能组成和为 y 的方案数 #include<bits/stdc++.h> using namespace std; typedef long long ll; const i 阅读全文
posted @ 2019-09-15 23:06 starve_to_death 阅读(278) 评论(0) 推荐(0)
摘要:题:https://nanti.jisuanke.com/t/41403 题意:求任意俩点之间距离之和模3后的三个结果的总数(原距离之和) 第一种做法: 树形dp #include<bits/stdc++.h> using namespace std; #define pb push_back ty 阅读全文
posted @ 2019-09-15 09:11 starve_to_death 阅读(189) 评论(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 阅读(171) 评论(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 阅读(381) 评论(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 阅读(136) 评论(0) 推荐(0)
摘要:04 http://acm.hdu.edu.cn/showproblem.php?pid=6705 分析;先把每条边以 形式放进堆,堆按路径权值从小到大排序,然后每次取出堆顶,用v的出边扩展 新的路径。但是一个点的出度可能会非常大(如菊花图),可以发现,将出边排序之后, 每次只需要扩 展当前点最小的 阅读全文
posted @ 2019-08-24 00:03 starve_to_death 阅读(114) 评论(0) 推荐(0)
摘要:https://ac.nowcoder.com/acm/contest/890/F 题意:二维平面中有n个气球,你可以横着社三法子弹,竖着射三发子弹,且横着子弹的关系是y,y+r,y+2*r,竖着是x,x+r,x+2*r。问你怎么射才能射爆最多的气球。 分析:(代码注释) #include<bits 阅读全文
posted @ 2019-08-19 14:42 starve_to_death 阅读(201) 评论(0) 推荐(0)
摘要:https://ac.nowcoder.com/acm/contest/887/E 树状数组做法(代码有注释) #include<bits/stdc++.h> using namespace std; typedef long long ll; const int M=4e5+5; int x[M] 阅读全文
posted @ 2019-08-19 11:46 starve_to_death 阅读(143) 评论(0) 推荐(0)
摘要:A题 线段树可卡时限过 (1500MS) #include<bits/stdc++.h> using namespace std; typedef long long ll; const int inf=0x3f3f3f3f; const int M=1e5+5; int a[M],b[M],mpa 阅读全文
posted @ 2019-07-19 08:54 starve_to_death 阅读(246) 评论(0) 推荐(0)

1