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
codeforce
Nature Reserve
CodeForce
s - 1059D(二分+精度)
传送门:QAQ题意:给你n个动物的坐标,让你画个圆将所有的动物包括在内并且与y轴相切,问你是否存在这样的圆,并输出最小的圆半径。思路:很简单的二分形式,但是要怎么去检查这个半径是否可行呢。因为这个圆是和y轴相切的,所以对于每个点我们都可以算出圆心的x轴范围,然后记录一下是否有共用范围就行了。精度有点问题,突然发现浮点数运算的奥秘。代码:#include#include#include#includ
liexss
·
2020-08-24 08:26
CodeForce
s - 1060D E - Social Circles
题目链接思路:将左边最大和右边最大的合并,再放入重新考虑,知道没有人为止,因为可以有多个圆桌,所以可以简化为下列代码。#include#include#include#include#include#include#include#include#include//#includetypedeflonglongLL;usingnamespacestd;intl[100010],r[1000010]
leo_10
·
2020-08-24 08:18
贪心
CodeForce
s1102B--Array K-Coloring--思维
Youaregivenanarrayaaconsistingofnnintegernumbers.Youhavetocolorthisarrayinkkcolorsinsuchawaythat:Eachelementofthearrayshouldbecoloredinsomecolor;Foreachiifrom11tokkthereshouldbeatleastoneelementcolore
Preeee
·
2020-08-24 08:10
模拟
Codeforce
s Round #503 (by SIS, Div. 2) C. Elections(贪心)
题目链接:http://
codeforce
s.com/contest/1020/problem/C题意描述:有n个选民,m个政党(n,m#defineINF0x3f3f3f3f3f3f3f3f#definelllonglongusingnamespacestd
心照不必宣
·
2020-08-24 08:36
贪心
[cf] 1401 D.Maximum Distributed Tree
题目题目链接:https://
codeforce
s.ml/contest/1401/problem/D思路计算每个边的经过次数,然后把最大的p分配给次数最多的即可。
kosf_
·
2020-08-24 08:33
CodeForce
s - 275B (广搜)
Considerann × mgrid.Initiallyallthecellsofthegridarecoloredwhite.Lennyhaspaintedsomeofthecells(atleastone)black.Wecallapaintedgridconvexifonecanwalkfromanyblackcelltoanyanotherblackcellusingapathofsid
know_heng
·
2020-08-24 08:01
DFS
BFS
[dsu]
codeforce
s 375D. Tree and Queries
题意:给出一棵树,1是根节点,n个节点,每个节点有一种颜色。有m次询问,每次询问给出vk,求以v节点为根的子树中有多少种数量至少为k的颜色,一种颜色的数量就是该颜色的节点的数量。题解:离线,回答以v为根的询问时,如果暴力把整棵子树的颜色存进树状数组,复杂度是O(n2logn)。但是子树信息可以保留到父节点继续使用,如果要保留子树信息的话,容易发现处理两棵子树时,子树间会相互影响,所以先不保留地处理
kg20006
·
2020-08-24 08:56
ACM
题解
codeforce
469 B C -模拟 -构造
标题##B.ChatOnlineLittleXandLittleZaregoodfriends.Theyalwayschatonline.Butbothofthemhaveschedules.LittleZhasfixedschedule.Healwaysonlineatanymomentoftimebetweena1andb1,betweena2andb2,…,betweenapandbp(al
Jianbagengmu
·
2020-08-24 08:33
模拟
Codeforce
s Round #532 (Div. 2) E. Andrew and Taxi(二分+拓扑排序)
题目链接题意给你一个图1-n标号,m条有向边。每条有向边有一个权值,代表翻转其方向所需代价。求使得图变成无环图,翻转边权的最大值最小。思路二分答案,判断权值大于答案的边集是否能成环,如果不能说明答案可以再小点,否则答案可以大点。关键是翻转哪些边比较难想,第一次感受到拓扑排序,排序二字用处。按拓扑排序的顺序,给每个点从小到大赋权,最后判断如果起点权值大于终点权值则需要翻转。关于评论疑惑,猜测拓扑排序
ToRe.
·
2020-08-24 08:21
#
二分
拓扑排序
Codeforce
s Round #535 (Div. 3)C
题目来源:https://
codeforce
s.com/problemset/problem/1108/CYouhaveagarlandconsistingof?
稳健的不二少年
·
2020-08-24 08:28
字符串问题
C. Choosing flowers(枚举+思维+二分)
原题链接:https://
codeforce
s.com/problemset/problem/1379/C测试样例:Input24350142253524231Output1416样例解释:InthefirstexamplecaseVladimircanpick1flowerofthefirsttypeand3flowersofthesecondtype
叶的一生
·
2020-08-24 08:27
#
CF
#
2019级暑期第五场训练赛
思维
Distance and Axis(思维)
Codeforce
s Round #665 (Div. 2)
原题链接:https://
codeforce
s.com/contest/1401/problem/A测试样例:input6405801000000001010000001000000output031000000010
叶的一生
·
2020-08-24 08:26
#
CF
思维
Mere Array(排序+思维)
Codeforce
s Round #665 (Div. 2)
原题链接:https://
codeforce
s.com/contest/1401/problem/C测试样例:input418643662944567575224outputYESYESYESNO样例解释
叶的一生
·
2020-08-24 08:26
#
CF
思维
思维
Distinct Characters Queries(set处理)
Codeforce
s Round #590 (Div. 3)
原题链接:https://
codeforce
s.com/contest/1234/problem/D测试样例:Inputabacaba521414b15b246217Output312Inputdfcbbcfeeedbaea1516e14b261417b112c26821617c12f110a279110a114b11f2111Output52526
叶的一生
·
2020-08-24 08:26
#
CF
#
2019级暑期第二场训练赛
STL的使用
set
ACM-ICPC 2017 上海赛区ECFINAL I,M
题目链接:ChatGroup/**[链接]:https://
codeforce
s.com/gym/101775/problem/A**[题意]:给出n,m。问:从n个人中至少选m个人的方案数。
布呗之路
·
2020-08-24 08:24
记录
Codeforce
s Round #200 (Div. 1) C. Read Time 二分
/**
Codeforce
sRound#200(Div.1)C.ReadTime二分链接:https://
codeforce
s.com/contest/343/problem/C题意:n个刷子m个原点n个刷子同时左右进行刷问最少的时间使得
布呗之路
·
2020-08-24 08:24
CodeForces
ACM--二分
Codeforce
s Round #643 (Div. 2)C
题目链接题意:x,y,z三个整数满足a#definelllonglongusingnamespacestd;intmain(){ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);lla,b,c,d,ans=0;cin>>a>>b>>c>>d;for(lli=a+b;i<=b+c;i++){llx=min(b,i-b)-max(a,i-c)+1,z=min
丶di
·
2020-08-24 08:44
codeforces题解
codeforce
s 1355a 纯思路
题意:输入了a1和k,满足a(n+1)=an+minDigit(an)⋅maxDigit(an).求出来ak。思路:先看这一个题给的条件的范围,(1≤a1≤1e18,1≤K≤1e16)。一看范围这么大,这题肯定不会是模拟,模拟肯定会超时,也不会是打表之类的,因为给的数据范围实在是太大了。这题一定会有规律的。这里就涉及到英语题面的理解了,HereminDigit(x)andmaxDigit(x)ar
equation_H
·
2020-08-24 08:06
Codeforce
s D. Omkar and Bed Wars
D.OmkarandBedWarsOmkarisplayinghisfavoritepixelatedvideogame,BedWars!InBedWars,therearenplayersarrangedinacircle,sothatforalljsuchthat2≤j≤n,playerj−1istotheleftoftheplayerj,andplayerjistotherightofpla
henulmh
·
2020-08-24 08:34
CodeForce
s 245C Game with Coins
GamewithCoinshttp://
codeforce
s.com/problemset/problem/245/Ctimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputTwopiratesPolycarpusandVasilyplayaveryinteresting
hellohelloC
·
2020-08-24 08:02
未分类
Codeforce
s 1076E——回溯
题意:给出一棵以1为根的有根树,边权全部为1,点权初始全部为0,给出m个查询,每个查询给出三个变量vdx,表示将v节点的子节点(包括自己)中与v之间的距离usingnamespacestd;constintmaxn=3e5+10;typedeflonglongll;typedefpairP;intn,m;inttot,head[maxn];structEdge{intto,next;}edges[
hao_zong_yin
·
2020-08-24 08:22
数据结构
Codeforce
s 1076D Edge Deletion——最短路+dfs
题意:n个点m条边的无向连通图(无自环、重边),现在要删除一些边使得图最多剩下k条边,并且这样的点尽量多:这个点到1号节点的最短路不变思路:建出最短路树,统计边数,然后跑一遍dfs,在回溯的时候判断边数与k的关系,若边数>k就使边数减一,否则记录答案#includeusingnamespacestd;constintmaxn=3e5+10;typedeflonglongll;constllINF=
hao_zong_yin
·
2020-08-24 08:22
图论
codeforce
s 196b
http://
codeforce
s.com/contest/196/problem/BB.InfiniteMazetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputWe'vegotarectangularn
萌萌哒絮儿
·
2020-08-24 08:14
acm
codeforces
codeforces196b
Codeforce
s868E Policeman and a Tree -- DP
令fu,v,s1,s2表示当前在第u个点,将要走到第v个点,前面有s1个罪犯,后面有s2个罪犯,将所有罪犯抓到的最小时间。那么如果v是叶子,下一步可以直接抓到s1个罪犯,从fv,u,s2,0转移。否则,考虑在T时间内是否可以抓到:判断是否存在一种方案,将s1个罪犯分到v的所有子树中,使下一步到每棵子树的最小时间都大于T。如果存在,那么在T时间内无法抓到。然后用类似背包的做法。时间复杂度O(n5),
gjghfd
·
2020-08-24 08:04
DP
[ 杂题 ]
Codeforce
s955D Scissors
对于tt的每个前缀,双指针扫一遍求出在ss中出现的最左的位置,对每个后缀求出最右的位置。然后枚举tt中分割的位置就好了。注意判断tt在一个子串中出现的情况。UPD:感谢lifelikes指出错误。假如要求出最左的位置,由于要保证选的字符串长度至少为kk,所以初始时指针在kk。但这样有一种情况,就是tt串的一个前缀可以匹配ss串以kk为右端的一个子串,而此时指针已经移到了后面。一种解决办法是在这种情
gjghfd
·
2020-08-24 08:04
杂题
Codeforce
s Round #263 (Div. 2)A. Appleman and Easy Task
A.ApplemanandEasyTasktimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputToastmancameupwithaveryeasytask.HegivesittoAppleman,butApplemandoesn'tknowhowtosolveit.C
flyljg
·
2020-08-24 08:52
Codeforces
codeforce
s 732-D. Exams (二分)
http://
codeforce
s.com/problemset/problem/732/D题目大意:一个人有m门科目需要考试,每一门科目需要a[i](1#include#include#include
FZH_SYU
·
2020-08-24 08:45
ACM
codeforces
codeforce
s 375d Tree and Queries
http://www.elijahqi.win/2018/03/01/
codeforce
s-375d/题意翻译给出一棵n个结点的树,每个结点有一个颜色ci。
elijahqi
·
2020-08-24 08:33
莫队
Mahmoud and Ehab and the xor
CodeForce
s - 862C (异或性质)
MahmoudandEhabareonthethirdstageoftheiradventuresnow.Asyouknow,Dr.Evillikessets.Thistimehewon’tshowthemanysetfromhislargecollection,butwillaskthemtocreateanewsettoreplenishhisbeautifulcollectionofsets
elbadaernu
·
2020-08-24 08:03
数论
Codeforce
s Round #655 (Div. 2) / contest 1372
目录AOmkarandCompletionBOmkarandLastClassofMathCOmkarandBaseballDOmkarandCircleEF题目地址:https://
codeforce
s.com
dragonylee
·
2020-08-24 08:28
codeforces
Codeforce
s Round #643 (Div. 2) / contest 1355
ASequencewithDigitsBYoungExplorersCCountTrianglesDGameWithArrayERestorerDistanceFABCDEF√√√√√●(√:做出;●:尝试未做出;○:已补题)题目地址:https://
codeforce
s.com
dragonylee
·
2020-08-24 08:28
codeforces
2018.10.04
codeforce
s1060D. Social Circles(贪心)
传送门一道神奇的贪心。考虑每次加入一个人,他要么新构成一个圈,要么利用之前已有的空位。而不论如何决策,增加的贡献只跟当前左右l,rl,rl,r的最大值有关,因此我们只需保证每次取得的max(l,r)max(l,r)max(l,r)最小就行了。因此我们可以将数组l,rl,rl,r排序,每次增加max(li,ri)+1max(l_i,r_i)+1max(li,ri)+1就可以了。代码:#include
SC.ldxcaicai
·
2020-08-24 08:28
#
贪心
Codeforce
s Round 530 大下分记
Codeforce
sRound530赛前觉得还是要下分的。希望是毒奶。没想到是大毒奶。rating-91->1329我又绿了。以后再也不熬夜打cf了,一点状态都没有。A还是考英语。
dianshu0741
·
2020-08-24 08:20
Codeforce
s 1076D——最短路算法
题目给你一个有n个顶点、m条边的无向带权图。需要擦除一些边使得剩余的边数不超过k,如果一个点在原始图到顶点1的最短距离为d,在删边后的图中到顶点的最短距离仍是d,则称这种点是good。问如何删边,使得good点最多。分析首先调用最短路算法求各点到顶点1的最短距离,同时记录下每点在最短路上的前一个顶点。然后从顶点1出发搜索一个大小为k的联通块即可(如果够k个)代码1#include2#include
dianshu1593
·
2020-08-24 08:20
codeforce
s - 377A 题解
题目大意:给定一个n*m区域,#为墙,“.”为空地,填充k片空地,同时使得剩下的空地继续保持连通题目解法:DFS遍历sum-k片空地(sum是空地总数),然后枚举一遍,没有被遍历过的空地全部填充1#include2#include3#include4#include5#include6usingnamespacestd;7intmap[502][502];8boolvis[502][502];9i
dgr42861
·
2020-08-24 08:49
Codeforce
s Round #535 (Div. 3) 题解
Codeforce
sRound#535(Div.3)题目总链接:https://
codeforce
s.com/contest/1108太懒了啊~好久之前的我现在才更新,赶紧补上吧,不能漏掉了。
dft539533
·
2020-08-24 08:49
Codeforce
s Round #263 (Div. 1)
题目:http://
codeforce
s.com/contest/461题解:http://
codeforce
s.com/blog/entry/13568
dezhonger
·
2020-08-24 08:48
Codeforces
CodeForce
s 980 C Posterized
Posterized题意:将[0,255]分成若干段,每一段的长度最多为k,每一个数只能被放进一个段里,然后每一段的数组都可以被这一段最小的数字表示,求最小的字典序。题解:每次一个访问到一个数没被放到段里时,就在不破环前面分好段的情况下,尽可能将这个数分到前面段里去。然后将路上的点全部分到这段里。不要去去现在处理的这个数的后面的区域。如k=10;现在有一个序列为1,11那么如果你每次都从头开始染长
dengpangbu3703
·
2020-08-24 08:47
CF1102D-Balanced Ternary String-(贪心)
http://
codeforce
s.com/problemset/problem/1102/D题意:有n个字符,只能为012,现要通过变换让012的数量相等,并且使字典序最小。
dengpan1889
·
2020-08-24 08:16
codeforce
s 1102D White Lines
题目链接:http://
codeforce
s.com/contest/1200/problem/D这题比赛时没想出来,赛后补题时想出来了,还是自己太菜了。。。
dengcuo9877
·
2020-08-24 08:16
Codeforce
s Round #349 (Div. 2) C. Reberland Linguistics DP
题意:自己读了半天题,果断没看懂题意,看了题解才明白是这个意思啊。给一个字符串,去掉一个长度至少为5的前缀,剩下的切成长度为2或者3的串,且相邻的串不相同,问,最后可以切成多少个串且分别是什么;思路:dp[i][2]==1表示i,i+1形成的串可以满足要求,dp[i][3]==1同理;再就是转移了;考虑i位置,长度为2;(1)如果(i,i+1)与(i+2,i+3)相同,那么只有dp[i+2][3]
denglao1906
·
2020-08-24 08:16
Codeforce
s Round #370 (Div. 2) E. Memory and Casinos (数学&&概率&&线段树)
题目链接:http://
codeforce
s.com/contest/712/problem/E题目大意:一条直线上有n格,在第i格有pi的可能性向右走一格,1-pi的可能性向左走一格,有2中操作:单点修改
dehs8915
·
2020-08-24 08:15
Codeforce
s #530.div2
A#includeusingnamespacestd;intmain(){inth,w,u1,d1,u2,d2,sum=0;cin>>w>>h>>u1>>d1>>u2>>d2;sum=w;while(h>0){sum=sum+h;if(h==d1)sum=sum-u1;if(h==d2)sum=sum-u2;sum=max(sum,0);h--;}coutusingnamespacestd;int
de0831
·
2020-08-24 08:42
Digits Are Not Just Characters
http://
codeforce
s.com/gym/102082/attachments/download/8301/asia-yokohama-regional-contest-2018-en.pdf
curiosity9
·
2020-08-24 08:31
Codeforce
s Round #275 (Div. 1)D(树形DP)
D.RandomFunctionandTreetimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouhavearootedtreeconsistingofnvertices.Let'snumberthemwithintegersfrom1toninclusive.T
cq_phqg
·
2020-08-24 08:21
树形DP
Codeforce
s Round #277 (Div. 2)D(树形DP计数类)
D.ValidSetstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAsyouknow,anundirectedconnectedgraphwithnnodesandn - 1edgesiscalledatree.Youaregivenanintegerdanda
cq_phqg
·
2020-08-24 08:20
树形DP
codeforce
s 208 E. Blood Cousins (dsu on the tree)
E.BloodCousinstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputPolycarpusgotholdofafamilyrelationshiptree.Thetreedescribesfamilyrelationshipsofnpeople,number
clover_hxy
·
2020-08-24 08:13
树链剖分
树上启发式合并
Codeforce
s 236B Easy Number Challenge 【因子和】
题目链接:
Codeforce
s236BEasyNumberChallengeB.EasyNumberChallengetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputLet
笑着走完自己的路
·
2020-08-24 08:06
数学
codeforces
codeforce
s 1076E Vasya and a Tree 树上主席树
E.VasyaandaTree题意:给你一棵1为根节点的树,初始每个节点权值为0,有m次操作,每次操作vdx,表示将以v为根的子树,深度不超过d的所有节点加上x。思路:从深度为1的根节点开始遍历,到了深度为dep的v节点,若是该节点有操作dx,那么以该节点为根的主席树就要在dep+d的点加上一个权值x,然后怎么计算该点的答案呢,该点的答案就是该点的主席树区间[dep,n]和。#include#in
一只叫橘子的猫
·
2020-08-24 08:55
数据结构----线段树
codeforces题解
K for the Price of One (Hard Version)
Codeforce
s Round #610 (Div. 2)B2
Codeforce
sRound#610(Div.2)B2.KforthePriceofOne(HardVersion)timelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputThisisthehardversionofthisproblem.Theonlydifferen
cwb丶
·
2020-08-24 08:51
想法
dp
上一页
90
91
92
93
94
95
96
97
下一页
按字母分类:
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
其他