![](https://img-blog.csdnimg.cn/2020031022384857.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
CF
一个小菜鸡的cf悲惨历程
浅眠流转
这个作者很懒,什么都没留下…
展开
-
E2. Three Blocks Palindrome (hard version)
文章目录[E2. Three Blocks Palindrome (hard version)](https://codeforces.com/contest/1335/problem/E2)题目大意解题思路代码E2. Three Blocks Palindrome (hard version)题目大意给你一个长度为 n 的数列,让你选取一种子序列,这种子序列最多有两种元素构成并且左边的和右边的元素不仅个数相同而且也是同一种元素。为你这种序列的最长长度是多少。解题思路观察数据发现,数组的长度最多是原创 2020-12-19 11:52:47 · 118 阅读 · 1 评论 -
E. Lomsat gelral(dsu on tree)
文章目录[E. Lomsat gelral](https://codeforces.com/contest/600/problem/E)题意解题思路代码E. Lomsat gelral题意统计每棵子树的最多的颜色节点的和是说少。解题思路最近刚学的 dsu on tree 这道题刚好是一道模板题。我们通过一次dfs搜索后,标记出每个节点的重儿子,然后遍历的时候先遍历亲儿子再遍历重儿子。附加一个大佬的博客和B站的视频讲解吧。博客链接视频连接代码#include<bits/stdc++.原创 2020-11-18 21:35:38 · 381 阅读 · 0 评论 -
I - Magic Potion(最大流)
文章目录[I - Magic Potion ](https://codeforces.com/gym/101981)题目大意解题思路代码I - Magic Potion 题目大意一共有 n 个英雄 m 个怪物,每个英雄只能击败他范围内的一个怪物,但是想在有K 瓶药水,每瓶药水可以使得一个英雄多击败一只怪物,问你所有的英雄最多可以击败多少只怪物。解题思路这个属于二分图的最大匹配问题。但是多出来 k 使得问题有点不一样了。我们可以更变下新的建图方法,新加三个节点。节点1作为新的源点,让他与每个英雄建一原创 2020-10-13 16:09:34 · 254 阅读 · 0 评论 -
Mediocre String Problem(马拉车+扩展KMP)
文章目录[Mediocre String Problem](https://codeforces.com/gym/101981)题目大意解题思路代码Mediocre String Problem题目大意给你一个串S,和一个串T,从S中选一个子串做前缀串然后与T的一个前缀串做后缀串组成新的字符串是一个回文串,而且S的子串的长度需要比T的前缀串的长度要长。问你有多少种选取方法。解题思路假设我们选取S串的S[i:j]S[i:j]S[i:j]和T串的T[1:K]T[1:K]T[1:K]组成的新串是一个回文原创 2020-10-12 20:57:57 · 320 阅读 · 0 评论 -
J - Prime Game
文章目录[J - Prime Game ](https://codeforces.com/gym/101981/attachments)题目大意解题思路代码J - Prime Game 题目大意根据公式很容易发现,让求这些数每次相乘后质因子的个数的和。解题思路我们发下,相乘后的质因子个数其实就是这些数的各自质因子个数的和,只不过要去掉重复的,暴力的方法就是我们按照公式计算,然后每次计算就用个set去重,但是这样是不行的。数据量太大了,因此我们要去想其他的方法,这时候肯定是需要计算每个数的贡献度了。原创 2020-10-12 11:34:46 · 227 阅读 · 0 评论 -
Exchanging Gifts(拓扑排序)
文章目录[E. Exchanging Gifts](https://codeforces.com/gym/102394/problem/E)大佬的博客E. Exchanging Gifts大佬的博客#include<bits/stdc++.h>using namespace std;const int mx=1000100;#define ll long longvector<int> ve[mx],vec[mx];unordered_map<int,ll&g原创 2020-09-29 17:35:52 · 597 阅读 · 0 评论 -
I. Interesting Permutation(思维)
文章目录[I. Interesting Permutation](https://codeforces.com/gym/102394/problem/I)题意解题思路代码I. Interesting Permutation题意给你一个数字n,然后有一个长度为n的数列,这个数列的第 i 项值时某个数列的前 i 项的最大值减去最小值的到的结果,问你用着n个数字能构造出来多少种长度为n的数列。解题思路不成立的情况就不总结了。直接说怎么构造可行解吧。如果某一项和前一项不相等,那么我们就可以在数量上乘以2原创 2020-09-27 19:20:50 · 633 阅读 · 0 评论 -
D. Yet Another Yet Another Task
文章目录[D. Yet Another Yet Another Task](https://codeforces.com/contest/1359/problem/E)题目大意解题思路代码D. Yet Another Yet Another Task题目大意给你一个长度为n的序列,你要从中选着任意一段连续的区间,然后用区间和减去这个区间最大值,问你可以的到的值最大是多少。解题思路由于n个数的值都很小,不超过30,我们可以发现,如果连续的去掉一个最大值以后,所有的数肯定不会超过这个数,所以可以枚举最原创 2020-09-16 19:22:07 · 128 阅读 · 0 评论 -
K. Key Storage(组合数学)
文章目录[题目链接:K. Key Storage](http://codeforces.com/contest/1267/problem/K)题目大意解题思路代码题目链接:K. Key Storage题目大意给你一个数让你求出这个数除以2,除以3,递推下去,直到除数为0的时候得到的余数相同的集合相同的数有多少个。解题思路大佬博客链接很好的一道排列组合问题。中间还有一些小的细节看代码吧。代码#include<bits/stdc++.h>using namespace std;#原创 2020-09-05 09:23:04 · 302 阅读 · 0 评论 -
C. Orac and LCM
文章目录[C - Orac and LCM](https://vjudge.net/contest/381079#problem/C)题意解题思路代码C - Orac and LCM题意给你 N 个数,让你求着 N个数任意两个数的lcm组成的 ** N*N/2 **个数的 gcd是多少;解题思路代码#include<bits/stdc++.h>using namespace std;#define ll long long#define fast ios::sync_wit原创 2020-07-04 08:01:28 · 218 阅读 · 0 评论 -
C. Yet Another Counting Problem
文章目录[C. Yet Another Counting Problem](https://codeforces.com/contest/1342/problem/C)题目大意解题思路代码C. Yet Another Counting Problem题目大意给你一个数字T,有T组测试数据;每组数据给你a,b,q,有q次询问;每次询问给你两个数组 l r,问你 l 到 r 这个区间内有多少个...原创 2020-04-27 20:30:59 · 592 阅读 · 0 评论 -
E. Array Shrinking
文章目录[E. Array Shrinking](https://codeforces.com/contest/1312/problem/E)题目大意解题思路代码E. Array Shrinking题目大意给你一个长度为n的数列,没两个相同的数字可以抵消,变成不这个数字大一的新数字,问你经过多次操作后,这一个数列最少省多少个。解题思路这是一个区间DP,,可能是我太菜了,我个人感觉就是换个...原创 2020-03-10 22:35:23 · 468 阅读 · 0 评论 -
G. Rikka with Intersections of Paths
文章目录[G. Rikka with Intersections of Paths](https://codeforces.com/gym/102012/problem/G)题目大意解题思路代码G. Rikka with Intersections of Paths题目大意多组输入开始一个数字 T 表示有 T 组输入给你一棵有 n 个节点的树,然后这棵树上有m条路被标记了,问你从这m条标记...原创 2020-03-06 18:21:16 · 681 阅读 · 0 评论 -
C. Primitive Primes
文章目录[C. Primitive Primes](https://codeforces.com/contest/1316/problem/C)题目大意解题思路代码C. Primitive Primes题目大意给你三个数 n,m,p 分别表示两个多项式一个有n项一个有m项,这两个多项式的系数各自的GCD都是1,问你两个多项式相乘得到的新多项式的第几项的系数不能没 p 整除。如果有多个答案随便...原创 2020-03-05 13:12:58 · 277 阅读 · 1 评论 -
C2. Skyscrapers (hard version)
文章目录[C2. Skyscrapers (hard version)](https://codeforces.com/contest/1313/problem/C2)题目大意解题思路代码C2. Skyscrapers (hard version)time limit per test:3 secondsmemory limit per test:512 megabytesinputsta...原创 2020-03-01 12:37:17 · 461 阅读 · 0 评论 -
E. Water Balance
文章目录[E - Water Balance](https://codeforces.com/contest/1300/problem/E)题目大意解题思路代码E - Water Balanceinput47 5 5 7output5.6666666675.6666666675.6666666677.000000000input57 8 8 10 12output...原创 2020-02-23 10:45:40 · 176 阅读 · 0 评论 -
F2. Animal Observation
文章目录[F2. Animal Observation (hard version)](https://codeforces.com/contest/1304/problem/F2)题目大意解题思路代码F2. Animal Observation (hard version)time limit per test:3 secondsmemory limit per test:512 mega...原创 2020-02-18 14:59:55 · 410 阅读 · 0 评论 -
E - 1-Trees and Queries
文章目录[题目链接:E - 1-Trees and Queries](https://codeforces.com/contest/1304/problem/E)题目大意解题思路代码题目链接:E - 1-Trees and Queriestime limit per test:4 seconds memory limit per test:512 megabytesinputstandar...原创 2020-02-17 16:36:23 · 238 阅读 · 0 评论 -
D. Shortest and Longest LIS
文章目录[题目链接:D. Shortest and Longest LIS](https://codeforces.com/contest/1304/problem/D)题目大意解题思路代码题目链接:D. Shortest and Longest LIStime limit per test3 secondsmemory limit per test256 megabytesinputst...原创 2020-02-17 11:43:13 · 372 阅读 · 0 评论 -
F. Good Contest(DP+组合数学)
文章目录[F. Good Contest](https://codeforces.com/contest/1295/problem/F)题目大意解题思路代码F. Good Contestinput31 21 21 2output499122177input242 133713 420output578894053input21 10 0output...原创 2020-02-02 22:00:59 · 312 阅读 · 0 评论 -
D. MEX maximizing
索引[题目:D. MEX maximizing](https://codeforces.com/contest/1294/problem/D)题目大意解题思路代码题目:D. MEX maximizingtime limit per test:3 secondsmemory limit per test:256 megabytesinputstandard inputoutputstand...原创 2020-01-31 19:01:35 · 456 阅读 · 1 评论 -
D. Same GCDs
题目链接:D. Same GCDstime limit per test:2 seconds memory limit per test:256 megabytesinputstandard inputoutputstandard outputYou are given two integers a and m. Calculate the number of integers x su...原创 2020-01-31 16:27:36 · 261 阅读 · 0 评论 -
C. NEKO's Maze Game
题目链接: C. NEKO’s Maze Gametime limit per test:1.5 secondsmemory limit per test:256 megabytesinputstandard inputoutputstandard outputNEKO#ΦωΦ has just got a new maze game on her PC!The game’s main...原创 2020-01-20 12:46:35 · 361 阅读 · 0 评论 -
D. Minimax Problem(二分)
题目链接:D. Minimax Problemtime limit per test:5 secondsmemory limit per test:512 megabytesinputstandard inputoutputstandard outputYou are given n arrays a1, a2, …, an; each array consists of exactly...原创 2020-01-15 19:57:00 · 338 阅读 · 0 评论 -
Dr. Evil Underscores(思维,位运算)
题目:Dr. Evil UnderscoresD. Dr. Evil Underscores time limit per test:1 secondmemory limit per test:256 megabytesinputstandard inputoutputstandard outputToday, as a friendship gift, Bakry gave Bada...原创 2020-01-12 11:06:36 · 298 阅读 · 0 评论 -
C. Berry Jam(前缀和)
C. Berry Jam(前缀和)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputKarlsson has recently discovered a huge stock of berry jam jars in the basem...原创 2019-12-20 13:18:34 · 439 阅读 · 2 评论 -
B. Balanced Diet(前缀数组+贪心)
Gym_102220_B_Balanced DietB. Balanced Diettime limit per test:2 secondsmemory limit per test:512 megabytesinput:standard inputoutput:standard outputTaylor is wandering in a milk candy store. The...原创 2019-11-18 21:03:17 · 1050 阅读 · 2 评论 -
Gym 102220E Minimum Spanning Tree
Gym 102220E Minimum Spanning TreeE. Minimum Spanning Treetime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputIn the mathematical discipline of g...原创 2019-11-17 18:57:23 · 168 阅读 · 0 评论 -
2019-2020 ICPC Southeastern European Regional Programming Contest (SEERC 2019)-G. Projection
题目链接:G. Projection题目Everybody knows that you are a TensorFlow fan. Therefore, you’ve been challenged to recreate the TensorFlow logo from two projections.Consider that you have a 3D volume, n×m×h, ...原创 2019-11-11 21:35:04 · 1459 阅读 · 0 评论 -
L - Divide The Students
L - Divide The Students题目链接A group of students has recently been admitted to the Faculty of Computer Sciences at the Berland State University. Now the programming teacher wants to divide them into t...原创 2019-11-02 17:44:16 · 714 阅读 · 0 评论 -
CF-1121D-D. Make The Fence Great Again
D. Make The Fence Great Againtime limit per test:2 secondsmemory limit per test:256 megabytesinputstandard inputoutputstandard outputYou have a fence consisting of n vertical boards. The width of...原创 2019-09-20 16:54:37 · 369 阅读 · 0 评论 -
Problem-1197C-C. Array Splitting
Problem-1197C-C. Array SplittingC. Array Splittingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output You...原创 2019-07-23 21:10:52 · 182 阅读 · 0 评论