codeforces
mizp
这个作者很懒,什么都没留下…
展开
-
Xenon's Attack on the Gangs Codeforces Round #614 (Div. 2)
Xenon’s Attack on the Gangs题意: 给你一棵树,将0~n-2一一赋值给n-1条边,则S最大可能取值S=∑1≤u<v≤nmex(u,v)S=\sum_{1\le u< v\le n}mex(u,v)S=∑1≤u<v≤nmex(u,v)mex(u,v)表示u到v的路径中未出现的最小非负数思路: 这里推荐一个视频题解,个人觉得讲得非常好 qscqes...原创 2020-01-22 17:07:15 · 376 阅读 · 0 评论 -
Codeforces Round #592 (Div. 2)
Codeforces Round #592 (Div. 2)A.B略C.The Football Season题意: 给你w,d,p,n,是否存在同时满足等式x∗w+y∗d=px*w+y*d=px∗w+y∗d=px+y+z=nx+y+z=nx+y+z=n思路: 因为1<d<w<1e5,故只要枚举d从一到1到w是否有符合的情况即可#include<bits...原创 2019-10-27 23:52:49 · 179 阅读 · 0 评论 -
Radio Stations (2-SAT) Codeforces Round #585
Radio Stations题意: 给你n对(x,y),至少选一个点,再给你m对限制(x,y),选了x就不能选y而且每个点都在一个可行范围内[l,r],对于你所选择的点集合都满足li<f<ril_i<f<r_ili<f<ri,请输出其中一种满足方案思路 要是没有区间范围限制就是普通2-SAT模板题,比较巧妙的是这个问题限制了区间问题r若ri<...原创 2019-10-25 14:04:26 · 139 阅读 · 0 评论 -
F1. Short Colorful Strip Codeforces Global Round 4 (区间dp)
链接: http://codeforces.com/contest/1178/problem/F1题面:There are n+1 distinct colours in the universe, numbered 0 through n. There is a strip of paper m centimetres long initially painted with colour 0...原创 2019-07-22 21:03:04 · 361 阅读 · 0 评论 -
Codeforces Global Round 4 D,E,F1
链接: http://codeforces.com/contest/1178D. Prime Graph(构造)题面:Every person likes prime numbers. Alice is a person, thus she also shares the love for them. Bob wanted to give her an affectionate gift b...原创 2019-07-22 21:03:25 · 241 阅读 · 0 评论 -
Yet Another Subarray Problem Codeforces Round 69 dp
链接: http://codeforces.com/contest/1197/problem/D题面:You are given an array a1,a2,…,an and two integers m and k.You can choose some subarray al,al+1,…,ar−1,ar.The cost of subarray al,al+1,…,ar−1,ar ...原创 2019-07-23 12:48:11 · 165 阅读 · 0 评论 -
Rectangle Painting 1 Codeforces Round #576 (Div. 2)
链接: https://codeforces.com/contest/1199/problem/F题面:There is a square grid of size n×n. Some cells are colored in black, all others are colored in white. In one operation you can select some rectang...原创 2019-08-06 19:29:29 · 223 阅读 · 0 评论 -
Codeforces Round #576 (Div. 2) C-F
链接: https://codeforces.com/contest/1199C. MP3(尺取+贪心)题面:One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a ...原创 2019-08-06 19:30:11 · 186 阅读 · 0 评论 -
Treasure Hunting Codeforces Round #577 (Div. 2)
链接: https://codeforces.com/contest/1201/problem/D题面:You are on the island which can be represented as a n×m table. The rows are numbered from 1 to n and the columns are numbered from 1 to m. There a...原创 2019-08-06 20:01:50 · 349 阅读 · 0 评论 -
Codeforces Round #585 (Div. 2)
链接A.Yellow Cards: 签到略B.The Number of Products(dp/思维)题意: 给给你一个数组,求子区间大于0与小于0的个数思路: 简单dp,另一种就是先算出负的,然后总的减去负的就是正的,有点巧妙1.dp#include<bits/stdc++.h>using namespace std;typedef long long ll;co...原创 2019-09-21 00:29:36 · 132 阅读 · 0 评论 -
Educational Codeforces Round 72 (Rated for Div. 2)
链接A. Creating a Character(签到)略B.Zmei Gorynich(签到)略C.The Number Of Good Substrings题意: 给你一个01串,问存在多少个子串的长度等于子串转换成十进制的数思路: 因为长度最大只有2e5,也就是说顶多子串含有1的长度不超过18,#include<bits/stdc++.h>using name...原创 2019-09-23 23:44:54 · 92 阅读 · 0 评论 -
Codeforces Round #588 (Div. 2)
Codeforces Round #588 (Div. 2)AB略C. Anadi and Domino题意:有如图所示的 21 个多米诺骨牌,给定一个无向图(无自环,无重边),一条边上可以放置一个多米诺骨牌。要求是如果两条边连接同一个顶点,那就必须使这两条边上的多米诺骨牌指向这个顶点的值相等,可以有不放的情况,问给定的图中最多可以放多少个多米诺骨牌。(n<=7)思路: 假设n&...原创 2019-10-05 16:36:41 · 187 阅读 · 0 评论 -
Codeforces Round #590 (Div. 3) D~F
Codeforces Round #590 (Div. 3)A,B,C:略D. Distinct Characters Queries(线段树或树状数组)题意: 给你一个字符串,有两个操作,1.修改某个位置 2.询问某段子串中不同的字符数思路: 用26颗线段树或者26个树状数组或者26个set记录即可#include<bits/stdc++.h>#define lowbit...原创 2019-10-07 14:12:52 · 153 阅读 · 0 评论 -
K-th Path Codeforces Round #575 (Div. 3)
链接: https://codeforces.com/contest/1196/problem/F题面:You need to print the k-th smallest shortest path in this graph (paths from the vertex to itself are not counted, paths from i to j and from j to ...原创 2019-08-04 11:10:39 · 165 阅读 · 0 评论 -
E. Count The Rectangles (Educational Codeforces Round 68)
题目链接: http://codeforces.com/problemset/problem/1194/E题意: 给你一些平行坐标轴的线段,不会有线段会互相覆盖,问这些线段组成多少个矩形?思路: 我们可以从下往上扫平行于x轴的线段,找到第一条后,然后确定与这条线段垂直相交的线段有多少个点,交点位置顺便用树状数组记录起来,接着枚举y位置看是否有平行与x轴的线段与上面记录的线段有交点,用树状数组...原创 2019-07-20 09:03:27 · 152 阅读 · 0 评论 -
Codeforces Round #540 (Div. 3) (problemset 1118)
[题目链接:] http://codeforces.com/contest/1118感想:这场比赛的题除了F2完全不会,其他还是不难想的,但是我的代码能力实在太弱,C题这种模拟题对我来说就是送命题,E题的位置让我以为是道难度很高的,后来补题一看不就是道普通题,还有英语能力实在弱鸡,A题一开始看错题意想复杂了,没有看到要精确买k单位水,以为超过k单位但花的钱少也是可以的。B题的话一开始读不懂题...原创 2019-02-23 13:32:52 · 130 阅读 · 0 评论 -
codeforces 1117 (div2)
[题目链接]:http://codeforces.com/contest/1117题外话: 现在弱鸡一枚,后面的难题将来能力提升再补A. Best Subsegment(签到题)题意: 使得某段连续区间平均值最大的区间最长思路: 一开始我的思路是前缀和,然后枚举区间复杂度O(n^2),这肯定TLE,仔细一想这不就是求整个区间的最大值有多少个相连#include&lt;bits/stdc+...原创 2019-02-19 21:51:51 · 246 阅读 · 0 评论 -
Codeforces Round #542
题目链接: http://codeforces.com/contest/1130B. Two Cakes(贪心)题意: 有两个n层蛋糕,现在有共2n层蛋糕分布在1-2n中,问你重新组装两个n层蛋糕最少需要走多少步,要求只能从最小叠到最大思路: 我们可以选取一组第一次出现各层的型号,另一组存储第二次出现各层的型号,但我也不会证明这样为什么就是最好的#include<bits/std...原创 2019-03-03 18:27:41 · 83 阅读 · 0 评论 -
Codeforces Round #547 (Div. 3)
题目链接: http://codeforces.com/contest/1141感想: 这套题给我的感觉STL用得好事半功倍,可惜我不会,逃~~A. Game 23题意: 给你两个数问你通过其中一个数一直乘2或乘3直到两个数相等,操作次数为多少?思路: 直接模拟#include<bits/stdc++.h>#define INF 0x3f3f3f3fusing names...原创 2019-04-10 18:22:39 · 110 阅读 · 0 评论 -
Codeforces Round #550 (Div. 3)
链接: http://codeforces.com/contest/1144先来说说做这套题时的感受,自己开了个虚拟场,然后开始傻逼俩小时,看什么都是模拟暴力题,结果第一题一开始题意就读错了,还好两个小样例自相矛盾,然后写了出来,然而已经四十分多分钟,接着B题,嗯傻叉的我又开始模拟过程了,结果用优先队列维护一波就可以省去模拟过程了,C题D题emmmm不难,emmE题想到了是给你两个26进制的数求...原创 2019-04-07 00:58:06 · 117 阅读 · 0 评论 -
Codeforces Round #552 (Div. 3) E~G
题目链接: http://codeforces.com/contest/1154E. Two Teams(双指针)题意: 给你一个1到N的排列,每次选中里面最大的数,将左边与右边各k个人选出,反复选,直到序列为空,奇数次被选中的人为1,偶数次被选中的人为2思路:用数组模拟双指针,而且set是有序的,所以可以set维护或者用优先队列#include<bits/stdc++.h>...原创 2019-04-21 23:21:08 · 125 阅读 · 0 评论 -
Codeforces Round #529 (Div. 3) D~F
题目链接: http://codeforces.com/contest/1095D. Circular Dance题意: 给出N个人身后所接着两个人,两个顺序不一定,问是否存在一群人围成一圈的排列方式思路:我们可以直接假设1号后面的那个人,只要确定的1个,接下来全部都确定了#include<bits/stdc++.h>using namespace std;const ...原创 2019-04-22 00:02:00 · 110 阅读 · 0 评论 -
Codeforces Round #565 (Div. 3) D~F
题目链接: https://codeforces.com/contest/1176题目:D. Recover it!题面:思路: 线性筛出199999个质数,顺便储存每个合数的最大因子,然后2750131开始倒推,大的质数肯定是某个小的数映射而来,大的合数可以求出最大因子数#include<bits/stdc++.h>using namespace std;typede...原创 2019-06-12 19:10:34 · 186 阅读 · 0 评论 -
Codeforces#1157 F. Ehab and the Big Finale (思维+交互题)
链接: http://codeforces.com/contest/1174/problem/F题意: 给你一颗树,需要你求出某个已知点,你有两种询问操作问你能否在36次询问之内得知所求点思路: 交互题的套路一般就是通过询问不断缩小范围逼近答案,如每次把范围缩小一半,这样就在logn次内询问出来这道题的做法就在于如何缩小范围,官方题解的做法预处理出子树的大小,通过找出重链,通过询问重链与...原创 2019-06-11 15:35:37 · 309 阅读 · 0 评论 -
Codeforces Round #566 (Div. 2) C
链接: https://codeforces.com/problemset/problem/1182/C题意:A lyric is beautiful if and only if it satisfies all conditions below.The number of vowels in the first word of the first line is the same as ...原创 2019-06-17 15:11:25 · 180 阅读 · 0 评论 -
Submarine in the Rybinsk Sea Codeforces Round #574 (Div. 2)
链接: http://codeforces.com/contest/1195/problem/D2题意:思路: 我们可以统计每一个数各个数位对所有组合的贡献,记得f(x,y)与f(y,x)f(x,y)与f(y,x)f(x,y)与f(y,x)是不同的,算贡献要注意#include<bits/stdc++.h>using namespace std;typedef long l...原创 2019-07-19 10:26:22 · 98 阅读 · 0 评论 -
OpenStreetMap Codeforces Round #574 (Div. 2)
题目链接: http://codeforces.com/contest/1195/problem/E题意: 给你一个n * m的矩形,问你它所有大小为a*b的子矩形的最小值之和是多少思路: 分别对每一行与每一列用单调队列维护子矩形的最小值,复杂度O(n∗m)O(n*m)O(n∗m)#include<bits/stdc++.h>using namespace std;type...原创 2019-07-19 10:30:24 · 140 阅读 · 0 评论 -
Codeforces Round #541 (Div. 2) F.
F. Asya And Kittens题意: 有1-n只小猫,开始将它们放在指定的n个单元格内,然后随机从n-1个隔板中拆除隔板,最终使得这些小猫在同一单元格。现在依次给出拆除隔板的顺序,比如:1 4 就表示1号和4号小猫之间的隔板会被拆除(注:只能拆除相邻区域小猫之间的隔板)。思路: 用并查集进行处理,用一个数组储存每个集合的最右边,用另一个数组储存每个集合的最左边,然后按顺序进行合并;...原创 2019-02-27 21:22:41 · 91 阅读 · 0 评论