随笔分类 -  Daily

摘要:P3376 【模板】网络最大流 #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; const int N=200+10,INF=0x3f3f3f3f; int h 阅读全文
posted @ 2022-11-08 21:06 menitrust 阅读(50) 评论(0) 推荐(0)
摘要:Codeforces Round #786 (Div. 3) A - Number Transformation #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> usi 阅读全文
posted @ 2022-05-06 21:37 menitrust 阅读(39) 评论(0) 推荐(0)
摘要:SZTU春季个人训练赛 A - Alphabet 最长上升子序列 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using namespace std; typede 阅读全文
posted @ 2022-04-29 16:50 menitrust 阅读(53) 评论(0) 推荐(0)
摘要:Codeforces Global Round 20 A - Log Chopping 看n太小直接用vector暴力模拟了,看题解发现代码十分简洁。 暴力模拟代码 #include<iostream> #include<cstdio> #include<algorithm> #include<cs 阅读全文
posted @ 2022-04-26 15:38 menitrust 阅读(43) 评论(0) 推荐(0)
摘要:AtCoder Beginner Contest 249 A - Jogging 没读好,题面有点问题20分钟后才了改题面。 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmat 阅读全文
posted @ 2022-04-26 00:48 menitrust 阅读(41) 评论(0) 推荐(0)
摘要:Educational Codeforces Round 127 (Rated for Div. 2) A - String Building a,b必须同时出现 #include<iostream> #include<cstdio> #include<algorithm> #include<cst 阅读全文
posted @ 2022-04-24 23:45 menitrust 阅读(53) 评论(0) 推荐(0)
摘要:Codeforces Round #782 (Div. 2) A. Red Versus Blue 直接挨个插空到没有为止 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath 阅读全文
posted @ 2022-04-19 15:25 menitrust 阅读(47) 评论(0) 推荐(0)
摘要:AtCoder Beginner Contest 236 A - chukodai #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using namespace st 阅读全文
posted @ 2022-04-15 22:48 menitrust 阅读(47) 评论(0) 推荐(0)
摘要:AtCoder Regular Contest 138 A - Larger Score 搞个结构体,存储每个点的值和位置,从大到小排序,当值相等时位置小的在前面。利用pos和ans找到当前大于k且id最小的点,和小于k的点,不断更新最小值。 #include<iostream> #include< 阅读全文
posted @ 2022-04-10 16:57 menitrust 阅读(62) 评论(0) 推荐(0)
摘要:Codeforces Round #781 (Div. 2) A. GCD vs LCM 啊,太久没接触最小公倍数了脑子抽了相成了最大公倍数,导致搞了很久。 #include<iostream> #include<cstdio> #include<algorithm> #include<cstrin 阅读全文
posted @ 2022-04-09 19:24 menitrust 阅读(23) 评论(0) 推荐(0)
摘要:Codeforces Round #739 (Div. 3) A. Dislike of Threes #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using na 阅读全文
posted @ 2022-04-08 11:04 menitrust 阅读(40) 评论(0) 推荐(0)
摘要:AtCoder Beginner Contest 246 A - Four Points 统计一下谁只出现过一次输出就行,看别人直接异或更简洁 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #inc 阅读全文
posted @ 2022-04-03 00:35 menitrust 阅读(42) 评论(0) 推荐(0)
摘要:Codeforces Round #780 (Div. 3) A. Vasya and Coins #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using name 阅读全文
posted @ 2022-04-01 09:59 menitrust 阅读(115) 评论(0) 推荐(0)
摘要:Codeforces Round #779 (Div. 2) A. Marin and Photoshoot 把所有0的位置找出来放到数组里,如果相邻的0距离为1的话,说明要往中间插2个1,如果距离为2的话只需要插1个1。 #include<iostream> #include<cstdio> #i 阅读全文
posted @ 2022-03-28 01:51 menitrust 阅读(76) 评论(0) 推荐(0)
摘要:AtCoder Beginner Contest 245 A - Good morning 感觉自己写的有点长了,还是题解来的简洁 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<c 阅读全文
posted @ 2022-03-27 21:56 menitrust 阅读(41) 评论(0) 推荐(0)
摘要:Codeforces Round #764 (Div. 3) A. Plus One on the Subset 从最小的变成最大的,也就是最大值和最小值之差。 #include<iostream> #include<cstdio> #include<algorithm> #include<cstr 阅读全文
posted @ 2022-03-23 23:27 menitrust 阅读(55) 评论(0) 推荐(0)
摘要:CFAB训练赛5 A - Assigning to Classes 从小到大排序,找到中位数以及和它的下一位,最小值就是他们之差。因为总是可以分成两组,那么我们只需要让这两个数分别是不同组的中位数就可以了,至于这两组怎么排序并不重要。 #include<iostream> #include<cstd 阅读全文
posted @ 2022-03-22 21:56 menitrust 阅读(41) 评论(0) 推荐(0)
摘要:蓝书 AcWing 193. 算乘方的牛 这里估计函数可以设计为当前的最大的数到目标数还需要乘多少次2。对于题目要求我们可以有8种操作方式,1.将a+b放在a的位置。2.将a+b放在b的位置再交换。3.a自乘。4.a自乘放在b的位置再交换。5.b自乘放在a的位置。6.b自乘再与a交换。7.a除b放在 阅读全文
posted @ 2022-03-21 14:44 menitrust 阅读(63) 评论(0) 推荐(0)
摘要:蓝书 AcWing 194. 涂满它! 这次终于写对估计函数了,这次把除了a[0][0]的颜色的个数当做估计函数。我们可以枚举5种颜色,同时判断那些是与左上角的点联通的并且颜色相同的点,把他们认定为待更新的点,并将它们更新(类似bfs),在不断搜索的时候时刻更新当前的层数和估计函数的和是否大于限定深 阅读全文
posted @ 2022-03-20 19:58 menitrust 阅读(41) 评论(0) 推荐(0)
摘要:蓝书 AcWing 190. 字串变换 一开始用的是双向bfs,但只过了4个点,但是硬是要调,调了一下午还是没调出来。。后面换成普通bfs写发现也能过而且代码更少看来不能老是死磕,思路就是直接开队列按字符串的位置找能换的字串,如果最后换到和b一样说明成功了并且操作小于10说明成功了,否则输出-1。 阅读全文
posted @ 2022-03-19 18:48 menitrust 阅读(67) 评论(0) 推荐(0)