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
CODEFORCES
Codeforces
Global Round 10 部分题解
A假如全部都一样,那么显然不能操作,否则肯定存在一个最大值,它旁边的值比他小,将他们合并之后最大值唯一,可以用这个新的最大值与其他全部合并起来。代码如下:#include#include#includeusingnamespacestd;#definemaxn200010intT,n;intmain(){scanf("%d",&T);while(T--){scanf("%d",&n);intlas
Hypoc_
·
2020-08-19 06:49
随笔小结
Codeforces
Global Round 2
Codeforces
GlobalRound2B-AlyonaandaNarrowFridge(贪心)#includeusingnamespacestd;typedeflonglongll;intmain
Achanss
·
2020-08-19 06:41
综合
Codeforces
Global Round 10 部分题解
文章目录1392A-OmkarandPassword1392B-OmkarandInfinityClock1392C-OmkarandWaterslide1392D-OmkarandBedWars1392E-OmkarandDuck1392F-OmkarandLandslide1392G-OmkarandPies1392H-ZSShufflesCards1392A-OmkarandPassword
zsyzlzy
·
2020-08-19 06:08
比赛
Minimum Array
https://
codeforces
.com/contest/1157/problem/E题意:重新排序b数组,使得ci=(ai+bi)%n的字典序最小题解:用multiset存储b数组,lower_bound
STZG
·
2020-08-19 05:56
#
C++
Omkar and Bed Wars【
Codeforces
Global Round 10 D】【DP】
题目链接CF-1392D有N个人围坐成一个环,每个人会打左边或者右边的那个人,如果只有某一边的人打他,那么他就会只打这一边(打回去),否则,他打哪一边都是可以的(但是一定要打),现在,为了是给出的长度为N的「L、R」串符合规则,问最小需要修改的次数。于是,开始的时候想法是状压DP,我想,某个点i,它收到的影响只会跟前后两个点有关,但是因为我们的正向DP是不能考虑后继的影响,所以如果将状态压进来还是
Andres_Lionel
·
2020-08-19 03:25
DP动态规划
dp
Codeforces
Round #304 (Div. 2)
A.SoldierandBananasAsoldierwantstobuywbananasintheshop.Hehastopaykdollarsforthefirstbanana,2kdollarsforthesecondoneandsoon(inotherwords,hehastopayi·kdollarsforthei-thbanana).Hehasndollars.Howmanydolla
Joursion
·
2020-08-18 23:13
CF
-
ABC
BC
-
AB
Codeforces
Round #303 (Div. 2)
A.ToyCarsLittleSusie,thankstoherolderbrother,likestoplaywithcars.Todayshedecidedtosetupatournamentbetweenthem.Theprocessofatournamentisdescribedinthenextparagraph.Therearentoycars.Eachpaircollides.The
Joursion
·
2020-08-18 23:41
CF
-
ABC
BC
-
AB
CF 332 C 贪心
题目链接:http://
codeforces
.com/problemset/problem/332/C参考链接:http://blog.csdn.net/cc_again/article/details
左眼皮跳跳~
·
2020-08-18 22:11
贪心
Codeforces
Round #664(Div.2) A,B,C,D
ABoboniuLikestoColorBalls分情况讨论一下即可。全为偶数,或者三个为偶数,是肯定可以的。只有两个为偶数是肯定不可以的。有一个为偶数,或者没有一个是偶数的情况,得看是否红,蓝,绿气球都有,如果都有则可以(可以转化成成立的情况),否则不可以。#include#includeusingnamespacestd;intT,r,g,b,w;intmain(){scanf("%d",&T
nefu_cbw
·
2020-08-18 18:55
Codeforces排位日记
算法
2020寒假训练汇总
cfid:ILLLZKQF场次:8701.21Educational
Codeforces
Round41(RatedforDiv.2)solved:5/7rank:94补题:7/701.22
Codeforces
Round
syh0313
·
2020-08-18 16:15
2020赛季CF训练记录
cfid:ILLLZKQF05.09
Codeforces
Round#640(Div.4)solved:7/7补题:7/705.14
Codeforces
Round#642(Div.3)solved:6/6
syh0313
·
2020-08-18 16:15
训练记录
【CF】
Codeforces
Round #515 (Div. 3)
目录前言传送门题目A-VovaandTrainDescriptionInputOutputExampleNoteSolutionCodeB-HeatersDescriptionInputOutputSampleIn1SampleOut1SampleIn2SampleOut2SampleIn3SampleOut3SampleIn4SampleIn4SolutionCodeC-BooksQueries
Z__X
·
2020-08-18 16:53
Codeforces-CF
算法
CF
Codeforces
731D 求所有区间的交(树状数组或前缀和)
题意:给你n个word,每个word都有若干个字母,现在要使得从上到下的word都必须小于或等于下一个word,你可以操作一次钥匙将所有word的所有字母都加上1,如果>c,就变为1,问是否有解,有的话随意输出,没有的话就输出-1;思路:对于每两个上下相邻的word,去求出使得它们满足字典序的区间,再从0-c-1中找有没有点是n-1,也就是n-1个区间的共同交集。这里用树状数组实现,注意C开的范围
奶瓶他哥
·
2020-08-18 15:55
树形背包DP的两种优化方式——vijos1676、
codeforces
815c
1.O(nm)——vijos1676陶陶吃苹果背景陶陶很喜欢吃苹果。描述curimit知道陶陶很喜欢吃苹果。于是curimit准备在陶陶生日的时候送给他一棵苹果树。curimit准备了一棵这样的苹果树作为生日礼物:这棵苹果树有n个节点,每个节点上有c[i]个苹果,这棵树高度为h。可是,当curimit把这棵树给陶陶看的时候,陶陶却说:“今年生日不收礼,收礼只收节点数减高度不超过k的苹果树。”这下c
Sega_hsj
·
2020-08-18 15:29
dp
Codeforces
917D Stranger Trees 树形dp+容斥原理
题意给出一棵n个节点的带标号树,要求对于每个k,求出有多少棵生成树满足恰好有k条边与原树相同。n#include#include#include#includeusingnamespacestd;typedeflonglongLL;constintN=105;constintMOD=1e9+7;intn,size[N],cnt,last[N];LLfac[N],afac[N],g[N],f[N][
c_cl
·
2020-08-18 14:09
CF1076D Edge Deletion 最短路树
问题描述
Codeforces
洛谷(有翻译)题解最短路树,是一棵在最短路过程中构建的树。
LIUZHH2088
·
2020-08-18 13:08
CodeForces
5A
Polycarpisworkingonanewprojectcalled"Polychat".FollowingmoderntendenciesinIT,hedecided,thatthisprojectshouldcontainchataswell.Toachievethisgoal,Polycarphasspentseveralhoursinfrontofhislaptopandimpleme
零壹號
·
2020-08-18 12:34
CodeForces
水题
CodeForces
754A题意:给一个数组,让你变成1-n,输出变换区间,要求原区间和不为0.思路:如果原数组不为0,那就是YES;如果为0,则从1开始扫过去,碰到不为0时,分两个区间[1,k],[k
weixin_30916125
·
2020-08-18 12:29
codeforces
5C Longest Regular Bracket Sequence
给一个括号序列,求满足括号匹配的最长子串长度和个数。可以用栈来依次记录序列中的左括号位置,每当出现一个右括号,判断栈是否为空,若不为空,用此时右括号的位置i减去最近的左括号位置再+1即可得到串的长度。需要注意的是这种情况:()(),在第二个括号之前已经有符合条件的串,这里需要记录左括号之前的位置已经得到的串的长度。设dp[i]表示到第i个右括号所获串的长度。则dp[i]=dp[t-1]+i-t+1
克莉丝汀娜
·
2020-08-18 12:45
Review of
Codeforces
5A and 5B(Python)
5A.ChatServer'sOutgoingTrafficSeemslikeasimpletask.However,youmayfinditisdifficulttotellthedeterminationoftheinput.Therearetwomethod:firstoneisusingsys.stdin.youmayneedtolearnhowtousesysmodel.Thesecon
大阳传奇
·
2020-08-18 11:11
codeforces
A - Chat Server's Outgoing Traffic
A-ChatServer'sOutgoingTrafficTimeLimit:1000MSMemoryLimit:65536KB64bitIOFormat:%I64d&%I64uSubmitStatusPractice
CodeForces
5ADescriptionPolycarpisworkingonanewprojectcalled"Polychat
sdjzping
·
2020-08-18 11:09
字符串
Codeforces
A. Arrival of the General(贪心)
AMinistryforDefensesentageneraltoinspecttheSuperSecretMilitarySquadunderthecommandoftheColonelSuperDuper.Havinglearnedthenews,thecolonelorderedtoallnsquadsoldierstolineupontheparadeground.Bythemilitar
饮酒在风里
·
2020-08-18 11:45
贪心
codeforce
codeforces
5C Longest Regular Bracket Sequence(dp+技巧)【最长连续括号模板】
Thisisyetanotherproblemdealingwithregularbracketsequences.Weshouldremindyouthatabracketsequenceiscalledregular,ifbyinserting«+»and«1»intoitwecangetacorrectmathematicalexpression.Forexample,sequences«(
wust_zwl
·
2020-08-18 11:46
ACM__区间DP
-----模板题型-----
【
CodeForces
5A】“忽略”的魅力——Chat Server's Outgoing Traffic
来源:CodeForce5A,点击打开链接ACM的精髓在于解决问题,而不是在于谁的代码看上去更高级。——RujiaLiu《算法艺术与信息学竞赛》这个题便充分的体现出了这一点。从INPUT来说看上去很复杂的样子,需要计算人数,统计人数,看谁走了……但其实,仔细看看,++,--管他加的谁还是减的谁,本来就是默认正确的,管他谁呢……这样工作量减少了一半以上,虽然看上去不严谨了,但其实思维正是如此。#in
mig_davidli
·
2020-08-18 11:37
简单大水题
Codeforces
5A Chat Servers Outgoing Traffic set的使用
水过~#include#include#includeusingnamespacestd;intnc=0;setse;intmain(){strings;intans=0;while(getline(cin,s)){if(s[0]=='+'){if(!se.count(s.substr(1))){se.insert(s.substr(1));nc++;}}elseif(s[0]=='-'){if(
西域小车
·
2020-08-18 11:45
Codeforces
Codeforces
水题训练(一)
A.TheatreSquare#includeintmain(){intn,m,a;longlongans,l,w,i,j;scanf("%d%d%d",&n,&m,&a);if(n%a==0)l=n/a;elsel=n/a+1;if(m%a==0)w=m/a;elsew=m/a+1;printf("%lld\n",l*w);}A.Watermelon#includeintmain(){intm;
Q王路飞
·
2020-08-18 10:40
Codeforces
5A
这题真是一道水题啊,只是输入有点问题,你只能边调试边看你的ans,然后交上去即可AC,反正我用的是getLine。不要管说话人是谁,谁进来或者谁出去,cnt维护聊天室内的人数,然后乘起来,累加即可。伏地%__debug大神。。。#include#include#include#include#include#includeusingnamespacestd;stringa;intmain(){in
Sakai_Masato
·
2020-08-18 10:54
codeforces
Codeforces
水题选刷
翻译会给出在代码中Ctrl+F点开网页搜索,直接查题号即可有一些很棒的题我会单独拿出来写题解的,特别水的题就不做了嘻嘻嘻
Codeforces
938C/*题解:给定两个正整数n,m(m≤n),对于一个n阶
Rose_max
·
2020-08-18 10:22
Codeforces
CodeForces
5A - Chat Servers Outgoing Traffic
1、理解题意,向在线的人发消息,计算长度2、使用cin.getline()读入数据#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusingna
yurio7r
·
2020-08-18 10:42
CodeForces
【每日练习】需要读题的codeforce5B
题目链接贴上,不多赘述http://
codeforces
.com/problemset/problem/5/B这道题首先是要读懂题,搞清楚题目的指示即将文本包围在一个符号*组成圈里面,字符串居中放置,若左右空格长度不一致
w1020187000
·
2020-08-18 10:21
数据结构与算法
【每日练习】抖机灵的DP codeforce 5C
惯例,扔题,懒得说http://
codeforces
.com/problemset/problem/5/C?
w1020187000
·
2020-08-18 10:21
数据结构与算法
【每日练习】水题codeforce5A
题目链接如下,不过多赘述http://
codeforces
.com/problemset/problem/5/A在做这道题的过程中,应该注意的是有关String类中几个函数的用法getline函数格式:
w1020187000
·
2020-08-18 10:20
数据结构与算法
Educational
Codeforces
Round 93 (Rated for Div. 2)补题
比赛链接C题意:问一串数字中有多少子串的长度等于串中所有数字之和思路:不会做,我只能想两重循环,一个数一个数的处理,时间复杂度1010,超时。其实可以不用一个数一个数的处理,只需要用一个map。因为如果要满足题目中的条件的话,子串中sum/len=1sum/len=1sum/len=1,即每个数都是1。我们从前往后遍历把每一个数减去1求前缀和。如果某一段的总和为0,就证明这一段是满足的。例如统计到
zhaochuannfei
·
2020-08-18 10:58
div2
codeforces
1070I 2018-2019 ICPC,NEERC,Southern Subregional Contest Privatization of Roads in Berlan
题面题意给出一张无向图,现在要对上面的边进行染色(可以认为有无数种颜色),并且每种边只能染一种颜色,每种颜色最多只能染两条边,并且与每个点相连的边最多只有k种颜色,请输出一种方案。做法首先如果存在一个度数大于2k2k2k的点,肯定无解,而对于度数小于等于kkk的点,则无论其周围的边如何染色,都不会超过kkk个颜色,因此我们只要考虑度数在k+1k+1k+1与2k2k2k之间的点即可。可以发现,对于度
yzyyylx
·
2020-08-18 10:49
网络流
技巧
AC自动机+DP
codeforces
86C
http://
codeforces
.com/contest/86/problem/CAC自动机加DP经典题目,题意:。。。思路:构建AC自动机,在AC自动机上跑,这样通过构造可以保证满足条件。
「已注销」
·
2020-08-18 10:58
dp
Educational
Codeforces
Round 55 G 最小割
题意,一个图,选一个子图,使得v[i]边权,a[i]点权思路:最小割经典模型,我们把边和源相连流量v[i],点和汇向连流量a[i],中间的依赖用inf相连,那么这样的图最小割的含义就是“不选的边和选了的点的和”,那么这个值最小答案自然最大,就是答案了代码:#include#definePBpush_back#defineXfirst#defineYsecond#defineFIOstd::ios:
「已注销」
·
2020-08-18 10:58
图论
Codeforces
1070C - Cloud Computing 思路+线段树+贪心 (2018-2019 ICPC, NEERC)
CF:*2000题意:有n天,每天需要用k个cpu,然后给定m个计划,对于每个计划包含L,R,c,p表示,从第L天到第R天期间,每天你都可以选用c个cpu,每个cpu的花费为p;问n天的最小花费;(当某天不能得到k个cpu时,就把能选的全选)思路:首先按暴力的思路选择,肯定是对于某一天优先选择价格p小的cpu,这样没错,但是复杂度不允许;然后我想到了把m个计划离线,按照价格p排序,以n天为线段树区
冰冰的小宝贝
·
2020-08-18 10:48
2018模板整理
前缀和
线段树
codefoces
贪心
CodeForces
-1201C(思维)
题目:https://vjudge.net/problem/
CodeForces
-1201C思路:这个题吧——可以进行k次让任意一个数+1,求最大的中位数。
古城白衣少年i
·
2020-08-18 09:27
思维
Candy Bag---
CodeForces
- 334A (思维)
题目链接:https://vjudge.net/problem/
CodeForces
-334AGeraldhasnyoungerbrothersandtheirnumberhappenstobeeven.Onedayheboughtn2candybags.Onebaghasonecandy
古城白衣少年i
·
2020-08-18 09:56
思维
codeforces
1316 C. Primitive Primes(思维)
C.PrimitivePrimestimelimitpertest1.5secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputItisProfessorR'slastclassofhisteachingcareer.EverytimeProfessorRtaughtaclass,hegaveaspeci
2018_XWJ
·
2020-08-18 09:17
思维
Codeforces
- Pencils and Boxes
题目链接:
Codeforces
-PencilsandBoxes显然可以dp,dp[i]为前i个是否合法。然后sort一下,然后枚举当前位置的时候,二分或者尺取找到最远的合法的位置。
青烟绕指柔!
·
2020-08-18 09:46
动态规划
Codeforces
Codeforces
- Inna and Dima
题目链接:
Codeforces
-InnaandDima先DFS判环。然后DAG上最长路。但是要注意最长路的时候,一定要从’D’开始。
青烟绕指柔!
·
2020-08-18 09:46
Codeforces
dfs
动态规划
Codeforces
- Colonial Mansions
题目链接:
Codeforces
-ColonialMansions两个之间能否连通,只在于相互之间的差值。我们用线段树维护差值即可,每个点的值是当前点和前一个点的差的绝对值。
青烟绕指柔!
·
2020-08-18 09:45
Codeforces
二分
线段树
codeforces
1070(差分||权值线段树)
https://
codeforces
.com/contest/1070/problem/C题意:有mmm种借用云计算内核的方案,第i种方案liricipili\ri\ci\piliricipi表示,表示这种方案的可借用时间是从第
- Passerby ゛
·
2020-08-18 09:07
线段树
Codeforces
985C (贪心)
传送门题面:C.Liebig'sBarrelstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouhavem = n·kwoodenstaves.Thei-thstavehaslengthai.Youhavetoassemblenbarrelsconsistin
Chen_Jr_
·
2020-08-18 09:28
思维
CodeForces
CodeForces
190D Non-Secret Cypher
双指针。#include#include#include#includeusingnamespacestd;constintmaxn=400000+10;intn,k,a[maxn],b[maxn];intcnt[maxn];intget(intval){intl=1,r=n;intpos=-1;while(lval)r=mid-1;elseif(b[mid]n||r>n)break;}print
weixin_34205076
·
2020-08-18 09:43
codeforces
590E Birthday【AC自动机+Floyd+匈牙利算法】
因为没有重复串,所以把有包含关系的串连边之后是个DAG,也就是二分图,就变成求二分图的最大独立集=n-最小点覆盖=n-最大匹配关于包含关系,建出AC自动机,然后把串放上去找子串,但是如果每次都一路找到根就会T,所以每次只找最近的一个,并且对于没有结尾id的点承接father的id,这样就O(1)的找到最近子串了然后再用floyd传递闭包把关系建出图来然后跑匈牙利,输出方案就是把一个匹配环里同一侧的
weixin_30408675
·
2020-08-18 09:13
Codeforces
339D Xenia and Bit Operations 线段树单点修改
传送门:http://
codeforces
.com/contest/339/problem/DD.XeniaandBitOperationstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputXeniathebeginnerprogrammerhasasequence
上决FX
·
2020-08-18 09:32
数据结构
Codeforces
Round #166 (Div. 2) D - Good Substrings
题意说的很清楚了,就是要寻找满足某一条件的不同字串个数。方法一:寻找不同字串个数体型很直接的一种方法就是把字符串hash值保存在set或者数组中,统计其中不同的个数。//一个长为n的字符串的字串个数为n*(n+1)/2#include#include#include#include#include#definemultiple1000000007//这里multiple如果选的太小(31,37,4
Benzema67
·
2020-08-18 09:32
codeforces
Rabin
Karp
codeforces
489 B BerSU Ball 匈牙利算法
裸的匈牙利算法求二分图#include#include#include#include#include#include#include#include#includeusingnamespacestd;#defineINF1e9#definemaxn110#definerep(i,x,y)for(inti=x;iG[maxn];boolvis[maxn];intlink[maxn];boolfin
u011327476
·
2020-08-18 09:40
二分图
上一页
102
103
104
105
106
107
108
109
下一页
按字母分类:
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
其他