![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
blue bear
这个作者很懒,什么都没留下…
展开
-
Educational Codeforces Round 94 (Rated for Div. 2) E. Clear the Multiset
TitleCodeForces 1400 E. Clear the MultisetTime Limit2 secondsMemory Limit256 megabytesProblem DescriptionYou have a multiset containing several integers. Initially, it contains a1a_1a1 elements equal to 111, a2a_2a2 elements equal to 222, …, ana_n原创 2020-08-26 01:29:29 · 131 阅读 · 0 评论 -
Educational Codeforces Round 94 (Rated for Div. 2) D. Zigzags
TitleCodeForces 1400 D. ZigzagsTime Limit2 secondsMemory Limit256 megabytesProblem DescriptionYou are given an array a1,a2…ana_1, a_2 \dots a_na1,a2…an. Calculate the number of tuples (i,j,k,l)(i, j, k, l)(i,j,k,l) such that:1≤i<j<k<l≤原创 2020-08-26 01:23:48 · 119 阅读 · 0 评论 -
Educational Codeforces Round 94 (Rated for Div. 2) C. Binary String Reconstruction
TitleCodeForces 1400 C. Binary String ReconstructionTime Limit2 secondsMemory Limit256 megabytesProblem DescriptionConsider the following process. You have a binary string (a string where each character is either 0 or 1) www of length nnn and an int原创 2020-08-26 01:12:44 · 110 阅读 · 0 评论 -
Educational Codeforces Round 94 (Rated for Div. 2) B. RPG Protagonist
TitleCodeForces 1400 B. RPG ProtagonistTime Limit2 secondsMemory Limit256 megabytesProblem DescriptionYou are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get res原创 2020-08-26 01:01:36 · 174 阅读 · 0 评论 -
Educational Codeforces Round 94 (Rated for Div. 2) A. String Similarity
TitleCodeForces 1400 A. String SimilarityTime Limit2 secondsMemory Limit256 megabytesProblem DescriptionA binary string is a string where each character is either 0 or 1. Two binary strings aaa and bbb of equal length are similar, if they have the s原创 2020-08-26 00:56:46 · 96 阅读 · 0 评论 -
Codeforces Round #665 (Div. 2)D. Maximum Distributed Tree
TitleCodeForces 1401 D. Maximum Distributed TreeTime Limit2 secondsMemory Limit256 megabytesProblem DescriptionYou are given a tree that consists of nnn nodes. You should label each of its n−1n-1n−1 edges with an integer in such way that satisfies t原创 2020-08-22 01:25:00 · 734 阅读 · 0 评论 -
Codeforces Round #665 (Div. 2) C. Mere Array
TitleCodeForces 1401 C. Mere ArrayTime Limit2 secondsMemory Limit256 megabytesProblem DescriptionYou are given an array a1,a2,…,ana_1, a_2, \dots, a_na1,a2,…,an where all aia_iai are integers and greater than 000.In one operation, you can choos原创 2020-08-22 01:23:10 · 246 阅读 · 0 评论 -
Codeforces Round #665 (Div. 2) B. Ternary Sequence
TitleCodeForces 1401 B. Ternary SequenceTime Limit2 secondsMemory Limit256 megabytesProblem DescriptionYou are given two sequences a1,a2,…,ana_1, a_2, \dots, a_na1,a2,…,an and b1,b2,…,bnb_1, b_2, \dots, b_nb1,b2,…,bn. Each element of both sequ原创 2020-08-22 01:20:05 · 747 阅读 · 8 评论 -
Codeforces Round #643 (Div. 2)A-E个人题解
Codeforces Round #643 Div. 2A-E个人题解[A.Sequence with Digits](https://codeforces.com/contest/1355/problem/A)题面水题AC代码[B. Young Explorers](https://codeforces.com/contest/1355/problem/B)题面桶+贪心AC代码[C. Count Triangles](https://codeforces.com/contest/1355/problem/原创 2020-05-17 11:53:47 · 362 阅读 · 0 评论 -
2020/5/10 每日一咕
2020/5/101.思维+STLProblem - 1277D - CodeforcesPolycarp has n different binary words. A word called binary if it contains only characters ‘0’ and ‘1’. For example, these words are binary: “0001”, “11”, “0” and “0011100”.Polycarp wants to offer his set of原创 2020-05-11 21:52:28 · 119 阅读 · 0 评论 -
Codeforces Round #639 (Div. 2) D. Monopole Magnets 思维+DFS
题面Problem - D - Codeforces (Unofficial mirror site by GGAutomaton, accelerated for Chinese users)A monopole magnet is a magnet that only has one pole, either north or south. They don’t actually exis...原创 2020-05-07 13:27:04 · 253 阅读 · 0 评论 -
2020/5/4/ 每日一咕
2020/5/4 来两道状压dp1.状压DP1434. 每个人戴不同帽子的方案数 - 力扣(LeetCode)总共有 nnn 个人和 404040 种不同的帽子,帽子编号从 111 到 404040 。给你一个整数列表的列表 hats ,其中 hats[i] 是第 i 个人所有喜欢帽子的列表。请你给每个人安排一顶他喜欢的帽子,确保每个人戴的帽子跟别人都不一样,并返回方案数。由于答案可能...原创 2020-05-04 10:33:12 · 155 阅读 · 0 评论 -
2020/5/1每日一咕
2020/5/11.字符串dpProblem - 1183H - Codeforces A subsequence is a string that can be derived from another string by deleting some or no symbols without changing the order of the remaining symbols. Cha...原创 2020-05-01 19:40:09 · 125 阅读 · 0 评论 -
2020/4/29 每日一咕
2020/4/291.二分Problem - 1251D - Codeforces题面You are the head of a large enterprise. n people work at you, and n is odd (i. e. n is not divisible by 2).You have to distribute salaries to your emplo...原创 2020-04-29 21:26:46 · 163 阅读 · 0 评论 -
Educational Codeforces Round 86 (Rated for Div. 2)个人A-D题解
A. Road To Zero给出x,y,a,b花a单位可以使x或y +1或-1花b单位可以使x和y +1或-12*a<=b时直接全部通过a否则通过b使一个降到0,再通过a(两种情况取小)B. Binary Period字符串的周期为对于所有1到|s|-k都有si==si+k的最小整数k。给出一个01串t求满足以下要求的串s1.01串2.长度不超过2*|t|3.t是s...原创 2020-04-27 10:58:20 · 122 阅读 · 0 评论 -
2020/4/26 每日一练
2020/4/26昨天摸了1.贪心+二分传送门给出一个长度为n的数组,元素%=m。一次操作可以选若干个数使他们变成(自身+1)%m。求最小操作使得数组非严格递增。贪心的想每个数在操作数范围内需要变得尽可能小,以使得后面的数递增比较容易。所以二分操作数,O(N)check。bool check(const int& mid, const vector<int>&...原创 2020-04-26 21:23:45 · 106 阅读 · 0 评论 -
2020/4/24 每日一练
2020/4/241.思维+组合数学传送门中文题目 不解释了 戳进去看就好了。朴素想法n*m*t 必超时想了很久没思路 开始推规律 发现和组合数相关奈何太菜 没想出来题解如下问题可以转化为以下模型:多次询问从点 (0,0) 出发,每个时刻可以选择将 x 坐标或 y 坐标增加 1 或不走动,时刻t走到点 (x,y)的方案数量。如果要在时刻t走到点(x,y),那么必定有x+y-1...原创 2020-04-24 23:00:02 · 105 阅读 · 0 评论 -
2020/4/23 每日一练
2020/4/231.树+思维传送门题意就是给出一棵树,带点权(-1e9<=vi<=1e9)。第一步先任选一个点,然后接下来选择的点满足这些条件1.它之前还没被选。2.它与一个被选的点直接相连。每选择一个点,与他直接相连的点和与与他直接相连的点直接相连的点的点权都+1。大概就是1连2,2连3,选择1,2和3点权都+1。求选完所有点的最大点权的最小可能值。分析后可以发现...原创 2020-04-23 17:09:38 · 96 阅读 · 0 评论 -
2020/4/22每日一练
2020/4/221.组合数学dp传送门定义一个数组为good,当且仅当它能够划分为若干个这样的子段(首元素等于区间长度-1 且 首元素>0)。求给出序列(长度1e3)中有多少个这样的子序列%mod。可能有点绕 上一下样例。输入41 1 1 1输出7包括任取两个,因为数组[1,1]中a[1]=区间长度-1=2-1=1以及全选,因为1 1 1 1可以划分为两个数组[1,1...原创 2020-04-22 22:02:55 · 97 阅读 · 0 评论 -
2020/4/21每日一练
2020/4/211.质因数分解 数学题传送门题意就是给出一个长度为n<=1e5的序列和一个k范围[2,100],元素范围[1,1e5]。求aiaj=pow(x,k) ,x是任意的。很容易想到用除过去map找,于是我就先预处理出每个数需要的最小数num,比如k=3时,2所需要的num就是4,因为24=8,num[12]是18因为12*18==pow(6,3)。这里我是用质因数分解和快...原创 2020-04-21 18:41:19 · 114 阅读 · 0 评论 -
2020/4/20每日一练
2020/4/201.思维+暴力传送门大意就是给一个长度为100的数字的串,找出其中能够被8整除的一个子序列。其实就是利用一个数能够被8整除后三位就可以被8整除的原理(因为1000的整数倍一定是8的倍数,同理还有4的是后两位)。所以三重循环枚举一下每一位,注意结果并不一定是三位,也有16,8这样的所以每重循环都要判断一下,代码如下。 string s; cin >>...原创 2020-04-20 19:24:25 · 159 阅读 · 0 评论 -
Codeforces Round #631 (Div. 2) D. Dreamoon Likes Sequences
题面传送门大概题意就是给出一个d和m。求满足以下条件的数组的数量模m。数组长度大于等于1数组所有元素大于等于1,小于等于d数组严格递增衍生数组( b1=a1, ∀i>1,bi=bi−1⊕ai)严格递增思路定义f(x)为x的下一位最小值打表可得f(1)=2,f(2)=f(3)=4,f(4)=f(5)=f(6)=f(7)=8…至于原因就是一个数若异或上自己最高也是1的那...原创 2020-04-04 18:33:21 · 117 阅读 · 0 评论 -
2019西安EC-final H-king (随机化+dp)
2019西安EC-final H-king (随机化+dp) 题目链接题面随机化算法正确性复杂度checkAC代码总结题目链接题面给出一个长度为n的序列,和一个小于1e9+7的质数。如果最长的模意义下的等比数列长度小于n/2则输出-1,否则则输出长度。随机化算法因为小于n/2的时候不用求出长度,而当长度大于n/2时,我们可以通过相邻两个数或者隔着一个数来计算q(通过逆元),再通过q出现的...原创 2020-01-12 19:53:40 · 598 阅读 · 0 评论 -
codeforces Rest Stops
贪心题面题意分析代码题面outputstandard outputFarmer John and his personal trainer Bessie are hiking up Mount Vancowver. For their purposes (and yours), the mountain can be represented as a long straight trail ...原创 2019-03-10 15:08:33 · 157 阅读 · 0 评论 -
POJ - 390 Sky Code
二进制 容斥原理题意代码#题面Stancu likes space travels but he is a poor software developer and will never be able to buy his own spacecraft. That is why he is preparing to steal the spacecraft of Petru. There is...原创 2019-03-09 22:26:01 · 184 阅读 · 0 评论 -
codeforces Lemonade Line
水题题面题意分析代码题面It’s a hot summer day out on the farm, and Farmer John is serving lemonade to his N cows! All N cows (conveniently numbered 1…N) like lemonade, but some of them like it more than others....原创 2019-03-12 15:58:07 · 167 阅读 · 0 评论 -
codefoces Teamwork
dp题面题面For his favorite holiday, Farmer John wants to send presents to his friends. Since he isn’t very good at wrapping presents, he wants to enlist the help of his cows. As you might expect, cows a...原创 2019-03-10 13:07:45 · 194 阅读 · 0 评论 -
codeforces The Bucket List
@toc# 题面outputstandard outputFarmer John is considering a change in how he allocates buckets for milking his cows. He thinks this will ultimately allow him to use a small number of total buckets, bu...原创 2019-03-10 11:17:31 · 151 阅读 · 0 评论 -
POJ - 2352 Stars
树状数组题面题意什么是树状数组?分析代码题面Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars ...原创 2019-03-10 00:43:32 · 140 阅读 · 0 评论 -
POJ - 2186 Popular Cows
tarjan算法 + 缩点题面题意分析代码题面Every cow’s dream is to become the most popular cow in the herd. In a herd of N (1 <= N <= 10,000) cows, you are given up to M (1 <= M <= 50,000) ordered pairs of ...原创 2019-03-09 23:44:12 · 138 阅读 · 0 评论 -
HDU - 6114 Chess
数论 费马小定理题面分析代码题面車是中国象棋中的一种棋子,它能攻击同一行或同一列中没有其他棋子阻隔的棋子。一天,小度在棋盘上摆起了许多車……他想知道,在一共N×M个点的矩形棋盘中摆最多个数的車使其互不攻击的方案数。他经过思考,得出了答案。但他仍不满足,想增加一个条件:对于任何一个車A,如果有其他一个車B在它的上方(車B行号小于車A),那么車A必须在車B的右边(車A列号大于車B)。现在要问问你...原创 2019-03-09 23:04:32 · 151 阅读 · 0 评论 -
HDU - 2602 Bone Collector
01背包题面inputOutput样例题目分析代码题目链接题面Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went ...原创 2019-03-06 16:02:02 · 160 阅读 · 0 评论 -
HDU - 2089 不要62
数位dp题面分析代码题目链接题面Problem Description杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。不吉利的数字为所有含有4或62的号码。例如:62315 73418 88914都属于不吉利号码。...原创 2019-03-08 20:07:36 · 112 阅读 · 0 评论 -
HDU - 1059 Dividing
01背包 + 二进制拆分[题目链接]原创 2019-03-07 21:15:54 · 197 阅读 · 0 评论 -
Code-forces 491-A 水题
Up the hill Code-forces 491-A 题面样例题意分析代码题面Hiking club “Up the hill” just returned from a walk. Now they are trying to remember which hills they’ve just walked through.It is known that there were N ...原创 2019-03-06 14:00:10 · 287 阅读 · 0 评论 -
dfs POJ-1979
dfs POJ-1979题目链接题面InputSample InputSample Output题意分析代码题目链接[https://vjudge.net/contest/279018#problem/I][http://poj.org/problem?id=1979]题面There is a rectangular room, covered with square tiles. Ea...原创 2019-02-19 20:46:43 · 178 阅读 · 0 评论 -
codeforces Mooyo Mooyo
挺有意思的题 双dfs题面题意分析代码题面With plenty of free time on their hands (or rather, hooves), the cows on Farmer John’s farm often pass the time by playing video games. One of their favorites is based on a popu...原创 2019-03-10 13:25:35 · 368 阅读 · 0 评论 -
codeforces Cowpatibility
map映射 + 二进制容斥题面题意分析代码题面It turns out there is one factor that matters far more than any other when determining whether two cows are compatible as potential friends: whether they like similar flavors ...原创 2019-03-10 13:44:56 · 154 阅读 · 0 评论 -
codeforces Team Tic Tac Toe
模拟水题题面题意分析代码题面Farmer John owns 26 cows, which by happenstance all have names starting with different letters of the alphabet, so Farmer John typically refers to each cow using her first initial – a ...原创 2019-03-12 15:51:13 · 188 阅读 · 0 评论 -
codeforces Out of Sorts
思维题题面题意分析代码题面outputstandard outputKeeping an eye on long term career possibilities beyond the farm, Bessie the cow has started learning algorithms from various on-line coding websites.Her favorite...原创 2019-03-12 15:47:54 · 139 阅读 · 1 评论