E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
Educational
Educational
Codeforces Round37 E - Connected Components?
#include#include#include#include#includeusingnamespacestd;constintN=2e5+5;vectorresult;std::set>unExistedMap;intnextPoint[N];intprePoint[N];classList{private:intheadPoint;voidinitialize(intn){headPoin
basasuya
·
2018-02-08 23:00
Educational
Codeforces Round 36 (Rated for Div. 2) E. Physical Education Lessons
提供两种思路一种线段树区间更新另一种用map维护连续的区间,也是题解的思路第二种很难写(我太渣,看了别人的代码,发现自己写的太烦了)#include#include#include#include#include#include#include#include#include#include#includeusingnamespacestd;typedeflonglongll;constintIN
basasuya
·
2018-01-23 21:00
你在叙利亚会怎么逃亡?
http://www.bbc.com/news/world-middle-east-32057601看到了bbc上面有一个这样的帖子,模拟了叙利亚人民逃亡的过程(并且还是根据真实的故事串起来的),觉得非常
educational
老乔理查德
·
2017-11-27 03:32
Educational
Codeforces Round 23 F. MEX Queries(线段树区间设值)
题意:一个无限长的序列,q次操作,有三种操作:1lr:将区间[l,r]设为12lr:将区间[l,r]设为03lr:将区间[l,r]的数反转(0变1,1变0)每次操作后输出最小的为0的位置下标(qusingnamespacestd;typedeflonglongll;constintmaxn=3e5+5;intn,treeSum[maxn*4],lazy[maxn*4],flag[maxn*4];l
cillyb
·
2017-10-08 13:04
线段树
Educational
Codeforces Round 25 E. Minimal Labels(拓扑排序)
题意:给你n个点,m条边的有向无环图,要求给n个点赋值1至n,每条边u->v要求val[u]usingnamespacestd;typedeflonglongll;constintINF=0x3f3f3f3f;constintmaxn=1e5+5;intdu[maxn],n,m;vectorg[maxn];queueqid;structnode{intid,val;booloperator,les
cillyb
·
2017-07-17 08:26
拓扑排序
Educational
Codeforces Round 23 D. Imbalanced Array(单调栈或RMQ+二分)
题意:imbalance值:一段区间中最大值与最小值之差给你一个数组(nusingnamespacestd;typedeflonglongll;constintmaxn=1e6+5;intn;lla[maxn],minl[maxn],minr[maxn],maxl[maxn],maxr[maxn];intmain(void){while(cin>>n){for(inti=1;is;while(!s
cillyb
·
2017-07-05 23:30
codeforces
二分
单调栈
RMQ
单调栈
二分
RMQ
Educational
Codeforces Round 24
陷入了一种每场比赛打完都不想改题的虚无状态,不能这样,改题改题改题。昨晚只写了三道题意即题解的题…感觉意识模糊,看了看是unrated就睡了CF已经连续三场unrated了qwq,我一共就没打过几场A.DiplomasandCertificates题意:拿到certificate的人数将会是拿到diploma人数的k倍,但拿到他们的总人数不能超过n/2把n/2向下取底分成k+1分#include#
Zars19
·
2017-06-30 13:00
【解题报告】
Educational
Codeforces Round 21
题目链接A.LuckyYear(Codeforces808A)思路本题的入手点是,想明白一个正整数只有一个非零位是什么概念。一个正整数只有一个非零位,那么这个数就只有最高位有非零位,也就可以表示成表示成这样:a∗10b,其中a∈[1,9]。那么我们可以设计出这样的算法:将正整数n的最高位增加1(如果是9的话就增加到10),然后将所有其它为清零得到一个新的数k,最后k−n就是答案。代码#includ
TRiddle
·
2017-05-31 10:00
codeforces
Education
Round-21
Educational
Codeforces Round 9 E.Thief in a Shop (FFT)★ ★
题意:给定n,k,然后给定n个1000以内的整数,求从中取k个(可重复取同一元素)能组成多少个不同的数,输出所有恰能用k个数组成的情况。分析:很明显这题只要将数x当做指数项直接去FFT即可,最后输出系数非0的项即可,另最大的数为x,mx=x*k,那么暴力FFT是O(mx*k*logmx),这样显然是不行的,我们可以将k进行快速幂那样的二分加速,那么就变成了O(mx*logmx*logk),其实我们
Ezereal
·
2016-09-06 16:44
杂七杂八
Educational
Codeforces Round 13 A.Johny Likes Numbers && B. The Same Calendar
传送门A.JohnyLikesNumberstimelimitpertest0.5secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputJohnylikesnumbersnandkverymuch.NowJohnywantstofindthesmallestintegerxgreaterthann,so
qingshui23
·
2016-06-25 21:00
CF解题报告
Educational
Codeforces Round 13 E. Another Sith Tournament
E.AnotherSithTournamenttimelimitpertest2.5secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputTherulesofSithTournamentarewellknowntoeveryone.nSithtakepartintheTournament.TheTour
Apm__5
·
2016-06-14 22:22
状压dp
dp
Educational
Codeforces Round 13 E. Another Sith Tournament 状压dp
E.AnotherSithTournament题目连接:http://www.codeforces.com/contest/678/problem/EDescriptionTherulesofSithTournamentarewellknowntoeveryone.nSithtakepartintheTournament.TheTournamentstartswiththerandomchoice
qscqesze
·
2016-06-14 09:00
Educational
Codeforces Round 13 D. Iterated Linear Function 水题
D.IteratedLinearFunction题目连接:http://www.codeforces.com/contest/678/problem/DDescriptionConsideralinearfunctionf(x) = Ax + B.Let'sdefineg(0)(x) = xandg(n)(x) = f(g(n - 1)(x))forn > 0.Forthegiveninteger
qscqesze
·
2016-06-14 08:00
Educational
Codeforces Round 13 C. Joty and Chocolate 水题
C.JotyandChocolate题目连接:http://www.codeforces.com/contest/678/problem/CDescriptionLittleJotyhasgotatasktodo.Shehasalineofntilesindexedfrom1ton.Shehastopainttheminastrangepattern.Anunpaintedtileshouldbe
qscqesze
·
2016-06-14 08:00
Educational
Codeforces Round 4 D. The Union of k-Segments(★)
题意:给定n个区间,问你被覆盖至少k次的区间最少有多少个,并输出.思路十分简洁,一个区间若被覆盖k次,则在这个区间前至少要出现k个线段的起点,且出现的起点减去终点数量不能小于k,这样排下序,线段起点+1,终点-1,判断下是否大于k一遍遍历下来就出答案了。#include#include#include#include#include#include#include#include#include#
Ezereal
·
2016-05-18 19:21
思维
Educational
Codeforces Round 11——C. Hard Process(YY)
C.HardProcesstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutput
a88770202
·
2016-05-12 16:00
【解题报告】
Educational
Codeforces Round 12
题目链接A.BusesBetweenCities(Codeforces665A)思路假设主角的车在s时刻出发,在t时刻到达。那么在这个时间段内在道路上出现过的由B驶来的车辆的数量ans就是答案。我们不管中间复杂的过程(其实也不怎么复杂)而只考虑s和t这两个时刻,那么ans=s时刻还在公路上的从B驶来的车的数量num1+在s时刻与t时刻之间的时间段内新出发的从B出发的车的数量num2。显然,num1
TRiddle
·
2016-05-03 23:00
codeforces
Education
Round-12
Educational
Codeforces Round 12 E. Beautiful Subarrays【字典树】
/************************************************Author:MaltubEmail:
[email protected]
:htttp://www.xiang578.top*************************************************/ #include #include #include #inc
xinag578
·
2016-04-30 09:00
Educational
Codeforces Round 11-D. Number of Parallelograms
用两条边平行且相等,判断平行四边形。把所有边转换成向量。mulitest记录每种向量的个数,在统计#include #definemaxn100005 #defineINF1e9 usingnamespacestd; typedeflonglongll; structNode{ Node(){ } Node(inta,intb){ x=a; y=b; } intx,y; lllen; frien
qq_26122039
·
2016-04-27 14:00
Educational
Codeforces Round 12 D. Simple Subset
D.SimpleSubsettimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAtupleofpositiveintegers {x1, x2, ..., xk} iscalledsimpleifforallpairsofpositiveintegers (i, j
longshanxiaoxuesheng
·
2016-04-25 20:00
模拟
CF
Educational
Codeforces Round 12 A. Buses Between Cities
A.BusesBetweenCitiestimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputBusesrunbetweenthecities A and B,thefirstoneisat05:00AMandthelastonedepartsnotlaterthanat
longshanxiaoxuesheng
·
2016-04-25 20:00
模拟
CF
Educational
Codeforces Round 12-E. Beautiful Subarrays
维护一个异或的前缀数组sum(),并把数组中的数挂在字典树上,寻找在sum(0)..sum(i-1)中和sum(i)异或值大于等于K的数的数目.累加#include #definemaxn205 #defineINF1e9 usingnamespacestd; typedeflonglongll; typedefstructNode{ intnum; Node*p[2]; }*T; Troot;
qq_26122039
·
2016-04-24 19:00
Educational
Codeforces Round 12 E. Beautiful Subarrays
题意:问有多少个连续区间异或和大于等于k思路:sum[l,r]=sum[1,l-1]^sum[1,r]所以记录异或前缀和,并用字典树维护从高位开始插入,num维护有多少数的前缀等于插入路径的,只要高位异或大于等于k,则之后肯定满足;否则,必须将cur的那一位置为1,然后继续。(因为退役已久,写了一发样例都没过,于是改着改着就改成codeforces的tutorial的样子,最后发现是我从低位开始插
u013007900
·
2016-04-23 15:00
Educational
Codeforces Round 12 F. Four Divisors 求小于x的素数个数(待解决)
F.FourDivisors题目连接:http://www.codeforces.com/contest/665/problem/FDescriptionIfanintegeraisdivisiblebyanotherintegerb,thenbiscalledthedivisorofa.Forexample:12haspositive6divisors.Theyare1,2,3,4,6and12
qscqesze
·
2016-04-22 22:00
Educational
Codeforces Round 12(B)暴力模拟
B.Shoppingtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAyushisacashierattheshoppingcenter.Recentlyhisdepartmenthasstarteda''clickandcollect"servicewhichal
qq_24489717
·
2016-04-22 15:00
Educational
Codeforces Round 12(C)贪心
C.SimpleStringstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputzscoder lovessimplestrings!Astring t iscalledsimpleifeverypairofadjacentcharactersaredistinct
qq_24489717
·
2016-04-22 15:00
Codeforces
Educational
Round 12 655ABCDE
CodeforcesEducationalRound12通过数:3A:刚开始用公式分类讨论,后面发现暴力才是一种更优美的解法#include usingnamespacestd; constintMAXN=10+5; charstr[MAXN]; intmain() { intx1,y1,x2,y2; while(scanf("%d%d%d%d",&x1,&y1,&x2,&y2)!=EOF){ s
beihai2013
·
2016-04-21 22:00
Educational
Codeforces Round 12 E. Beautiful Subarrays 字典树
E.BeautifulSubarrays题目连接:http://www.codeforces.com/contest/665/problem/EDescriptionOneday,ZStheCoderwrotedownanarrayofintegersa withelementsa1, a2, ..., an.Asubarrayofthearrayaisasequenceal, al +
qscqesze
·
2016-04-21 22:00
Educational
Codeforces Round 12 D. Simple Subset 最大团
D.SimpleSubset题目连接:http://www.codeforces.com/contest/665/problem/DDescriptionAtupleofpositiveintegers{x1, x2, ..., xk}iscalledsimpleifforallpairsofpositiveintegers(i, j)(1 ≤ i usingnamespacestd; c
qscqesze
·
2016-04-21 22:00
Educational
Codeforces Round 12 C. Simple Strings 贪心
C.SimpleStrings题目连接:http://www.codeforces.com/contest/665/problem/CDescriptionzscoderlovessimplestrings!Astringtiscalledsimpleifeverypairofadjacentcharactersaredistinct.Forexampleab,aba,zscoderaresimp
qscqesze
·
2016-04-21 22:00
Educational
Codeforces Round 12 B. Shopping 暴力
B.Shopping题目连接:http://www.codeforces.com/contest/665/problem/BDescriptionAyushisacashierattheshoppingcenter.Recentlyhisdepartmenthasstarteda''clickandcollect"servicewhichallowsuserstoshoponline.Thesto
qscqesze
·
2016-04-21 22:00
Educational
Codeforces Round 12 A. Buses Between Cities 水题
A.BusesBetweenCities题目连接:http://www.codeforces.com/contest/665/problem/ADescriptionBusesrunbetweenthecitiesAandB,thefirstoneisat05:00AMandthelastonedepartsnotlaterthanat11:59PM.AbusfromthecityAdeparts
qscqesze
·
2016-04-21 22:00
Educational
Codeforces Round 11 C (Two Pointers)
【题外话】我曾经用dp+二分写过这道题,当时是100多ms,今天了解到了twopointers这个东西,用twopointers的方法过了这道题!【题意】这道题的意思是给了一个只包含0,1的这样一个串,然后一个数k,最多讲k个0变成1,问你可能得到的最大的1的连续区间长度,并且输出改变后的数组!由于0的个数,从前导后具有单调性,因此,我们可以采用twopointers这种方法!事实证明,这个复杂度
just_sort
·
2016-04-18 18:00
Educational
Codeforces Round 9 C - The Smallest String Concatenation ,学习到string
题意非常简单,题目很水,:给你n个字符串,按字典序最小的顺序排列。如果用char数组将会非常的麻烦,但是你看看用string会多么简单赶紧学习一波string的用法#include #include #include #include #include #include #include #include #include #include #definemem(a)memset(a,0,size
qq_24664053
·
2016-04-17 21:00
Educational
Codeforces Round 8 F. Bear and Fair Set【最大流】
刚开始超时的建图1.先有s和t,s和余数建边,流量是n/5。2.对于i从1到b,i和余数建边,流量是1,将i和不超过i的最大限制建边,流量是1。3.之后再将限制之间相互建边。4.毫无疑问这个是超时的,而且也是不正确的,题目中每个限制区间是严格取的看了题解以后1.我第一写的1到b的建边其实是没有太大意义的2.之后只需要将数轴分区间就好了,比如限制是[1,n1],[1,n2],我们只需要转换成:[1,
xinag578
·
2016-04-16 11:00
初识树状数组
Educational
Codeforces Round 10 D - Nested Segments
记得以前就看过树状数组,好像因为并不能看懂,最近学习中偶得一文,讲解的十分清楚:贴个链接:http://blog.csdn.net/int64ago/article/details/7429868下面直接引用大牛所写的东西:lowbit(k)就是把k的二进制的高位1全部清空,只留下最低位的1,比如10的二进制是1010,则lowbit(k)=lowbit(1010)=0010(2进制)lowbit
qq_24664053
·
2016-04-15 21:00
Educational
Codeforces Round 11 D. Number of Parallelograms 【pair的使用】
平行四边形对角线两点连线的中点相同,利用这个性质可以快速计算。#include usingnamespacestd; map,int>mp; intx[2048],y[2048]; intmain() { intn,i,j; longlongans; scanf("%d",&n); for(i=0;i
xinag578
·
2016-04-13 08:00
Educational
Codeforces Round 11——A. Co-prime Array(map+vector)
A.Co-primeArraytimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenanarrayof n elements,youmustmakeitaco-primearrayinasfewmovesaspossible.Ineachmoveyo
a88770202
·
2016-04-09 21:00
Codeforences
Educational
Round 11
【题目链接】点击打开链接【题意】给了n,k,已经一个长度为n的01序列,问你在最多进行k此操作,(操作是把0变成1),能得到最大的连续1的长度。【分析】维护0的前缀和,对每个以i点开头的字串,二分查找能到达的最大位置,维护最大的答案。【AC代码】#include usingnamespacestd; inta[300005],dp[300005]; boolvis[300005]; intmain
just_sort
·
2016-04-09 13:00
Educational
Codeforces Round 11(C)尺取+前缀和
C.HardProcesstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenanarray a with n elements.Eachelementof a iseither 0 or 1.Let'sdenotethelengthofthelo
qq_24489717
·
2016-04-09 01:00
Educational
Codeforces Round 11(B)模拟
B.SeatingOnBustimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputConsider 2n rowsoftheseatsinabus. n rowsoftheseatsontheleftand n rowsoftheseatsontheright.Eachr
qq_24489717
·
2016-04-09 01:00
Educational
Codeforces Round 11(A)思维,数学
A.Co-primeArraytimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenanarrayof n elements,youmustmakeitaco-primearrayinasfewmovesaspossible.Ineachmoveyo
qq_24489717
·
2016-04-09 01:00
Educational
Codeforces Round 9
A.GrandmaLauraandApples题意:n和p分别表示有n次购买以及苹果的单价p;下面n行,half表示购买一半的苹果,halfplus表示购买一半的苹果再赠送半个苹果,n次购买之后苹果没有剩余,问一共卖了多少钱;思路:因为最后苹果没有剩余,即为0,所以我们从最后一次购买进行倒推,half—直接*2,halfplus—先+0.5再*2;#include #definell__int64
L_avender
·
2016-04-06 22:00
codeforces
Educational
Codeforces Round 10——B. z-sort
B.z-sorttimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAstudentof z-schoolfoundakindofsortingcalled z-sort.Thearray a with n elementsare z-sortediftwocondit
a88770202
·
2016-04-05 16:00
Educational
Codeforces Round 1 C. Nearest vectors 【极角排序atan2法】
题目链接atan2(y,x)计算点(x,y)和x正半轴的夹角(弧度制)。#include usingnamespacestd; typedeflongdoubleldb; constldbpi=3.1415926535897932384626433832795028841971; structnode { intid; ldbarc; booloperatorv; intmain() { in
xinag578
·
2016-04-03 11:00
Educational
Codeforces Round 10 D. Nested Segments 离散化+树状数组
首先将输入的l和r离散化,利用树状数组对所以r加一。之后再以l为关键字进行排序。从l小的开始考虑,ans=sum(r-1)-sum(l),之后再将r所在的树状数组减1。/************************************************Author:MaltubEmail:
[email protected]
:htttp://www.xiang578.to
xinag578
·
2016-03-30 14:00
Educational
Codeforces Round 10 E. Pursuit For Artifacts 强连通缩点+bfs
给定的图如果存在环,环内每一个点都可以相互达到,所以可以用强连通算法进行缩点。缩完点之后,图中所有的点之间只有一条路可以到达,直接可以用bfs进行求解。#include #include #include #include #include #include #include #include #include #include #include #include #include usingna
xinag578
·
2016-03-30 14:00
Educational
Codeforces Round 10 C. Foe Pairs
这题想了半个小时,敲了20-30分钟吧,其实脑子转快一点完全可以更快理解。主要感觉这题题意理解起来有点转来转去的。一开始有点没扯清题意:给你一个数组p,长度为n。这个p有1-n中的数组成。然后给你m对数(a,b)这个a,b并不是下标,是需要找到a和b在p中的下标是多少的。这个a和b是敌人,我们需要将整个数组划分成很多个区间:每一个区间不能包含任何一对敌人。问能将整个数组划分成多少个区间(x,y)这
qq_24664053
·
2016-03-29 19:00
Educational
Codeforces Round 10 E.Pursuit For Artifacts
E.PursuitForArtifactstimelimitpertest3secondsmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputJohnnyisplayingawell-knowncomputergame.Thegameareinsomecountry,wheretheplayercanfreelyt
acm_fighting
·
2016-03-29 16:00
Educational
Codeforces Round 10 D.Nested Segments
D.NestedSegmentstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregiven n segmentsonaline.Therearenoendsofsomesegmentsthatcoincide.Foreachsegmentfindthe
acm_fighting
·
2016-03-29 16:00
上一页
20
21
22
23
24
25
26
27
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他