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
Round #643 (Div. 2)(A, B, C, D, E)
Codeforces
Round#643(Div.2)SequencewithDigits思路一道暴力题,猜想在某一步一定会出现0,于是怀着忐忑提交了代码,结果还真的是这样。
_lifehappy_
·
2020-08-24 11:12
Codeforces
Round #629 (Div. 3) Editorial E. Tree Queries
讲解:https://blog.csdn.net/qq_45458915/article/details/105132814#include#include#include#include#includeusingnamespacestd;#definelllonglongconstintinf=0x3f3f3f3f;constintN=2e5+100;vectornode[N];intfa[N]
wtcl
·
2020-08-24 11:38
dfs序
codeforces
B. Young Explorers
题目题意:对于每一个人都会缺少一定的经验值,比如缺少333的经验值,那么此时就需要三个ai#include#include#include#include#include#include#include#include#include#include#include#includeusingnamespacestd;typedeflonglongll;typedefvectorveci;typed
忘梦心
·
2020-08-24 11:37
codeforces
codeforces
C. Mere Array
题目题意:给你一个序列,如果这个序列中的两个数满足gcd(ai,aj)=mini=1nagcd(a_i,a_j)=min^n_{i=1}agcd(ai,aj)=mini=1na,那么这两个数字就可以进行置换,问最后能不能通过置换将这个序列变成一个不递减的序列。思路:如果要满足gcd(ai,aj)=mini=1nagcd(a_i,a_j)=min^n_{i=1}agcd(ai,aj)=mini=1n
忘梦心
·
2020-08-24 11:37
codeforces
codeforces
C. Omkar and Waterslide
题目题意:给你一个序列,你有个操作,可以将连续不递减的区间里面的值都增加111,问最后要使这个序列变成不递减的序列要进行多少次这样的操作。思路:如果出现递减的情况,也就是ai#include#include#include#include#include#include#include#include#include#include#include#includeusingnamespacestd
忘梦心
·
2020-08-24 11:37
codeforces
codeforces
D. Omkar and Bed Wars
题目题意:有一个游戏,把大家围成一个圈,每一个人都可以攻击相邻的人,这样会造成人受到的攻击数为0,1,20,1,20,1,2,当只受到一个人的攻击时,此时你需要反击这个人才算合理,如果没有反击的话,你需要进行纠正,问最少需要纠正多少次。思路:首先有两种情况:全部都为同一个方向的(比如RRRRRR),当我们需要最少纠正的时候,我们可以每三个纠正一次,因为可以将RRRRRRRRR变成RRLRRLRRL
忘梦心
·
2020-08-24 11:37
codeforces
codeforces
B. Omkar and Infinity Clock
题目题意:给你一个n,kn,kn,k和一个aaa序列,你可以进行操作,计算出aaa中的最大值ddd,然后ai=d−aia_i=d-a_iai=d−ai,进行kkk次这样的操作,求出最后的aaa序列。思路:我们列出操作后的序列:第一次:b1,b2,b3,....bn(max=d)b_1,b_2,b_3,....b_n(max=d)b1,b2,b3,....bn(max=d)第二次:d−b1,d−b2
忘梦心
·
2020-08-24 11:37
codeforces
codeforces
B. Ternary Sequence
题目题意:给你666个数字分别代表两个序列中的0,1,20,1,20,1,2的数量,然后通过ci={ai∗bi,ai>bi0,ai=bi−ai∗bi,aib_i$}\\0,&\text{$a_i=b_i$}\\-a_i*b_i,&\text{$a_ibiai=biai#include#include#include#include#include#include#include#include#i
忘梦心
·
2020-08-24 11:37
codeforces
codeforces
A. Distance and Axis
题目题意:给你两个整数n,kn,kn,k,其中AAA点刚开始的坐标为nnn,现在你要保证∣(B−0)−(A−B)∣=k|(B-0)-(A-B)|=k∣(B−0)−(A−B)∣=k,问BBB的坐标是多少。思路:我们将公式化简一下可以得到∣2∗B−A∣=k|2*B-A|=k∣2∗B−A∣=k,我们假设A≥2∗BA\geq2*BA≥2∗B,那么就有(A−k)/2=B(A-k)/2=B(A−k)/2=B即
忘梦心
·
2020-08-24 11:37
codeforces
codeforces
D. Maximum Distributed Tree
题目题意:给你一棵数,现在你要将这棵树上附上权值并且满足一下条件:每一个权值都是正整数。n−1n-1n−1个数的乘积要等于kkk第三个条件看不懂QAQQAQQAQ,但是应该不太重要…现在设置f(u,v)f(u,v)f(u,v)为节点u→vu\tovu→v的权值,需要你求出最大的∑i=1n−1∑j=i+1nf(i,j)\sum^{n-1}_{i=1}\sum^n_{j=i+1}f(i,j)i=1∑n
忘梦心
·
2020-08-24 11:37
codeforces
Codeforces
Round #648 (Div. 2) 题解
A.MatrixGame查看题解博弈论B.TroubleSort查看题解思维C.RotationMatching查看题解排序D.SolveTheMaze查看题解bfsE.MaximumSubsequenceValue查看题解贪心+位运算F.SwapsAgain查看题解排序
忘梦心
·
2020-08-24 11:06
codeforces
Codeforces
Round #665 (Div. 2) 题解
A.DistanceandAxis查看题解数学B.TernarySequence查看题解贪心C.MereArray查看题解排序D.MaximumDistributedTree查看题解dfs树
忘梦心
·
2020-08-24 11:06
codeforces
Codeforces
Round #643 (Div. 2) 题解
A.SequencewithDigits查看题解数学B.YoungExplorers查看题解贪心C.CountTriangles查看题解前缀和D.GameWithArray查看题解构造E.RestorerDistance查看题解三分
忘梦心
·
2020-08-24 11:06
codeforces
Codeforces
Round #655 (Div. 2) 题解
A.OmkarandCompletion查看题解构造B.OmkarandLastClassofMath查看题解数学C.OmkarandBaseball查看题解思维D.OmkarandCircle查看题解前缀和
忘梦心
·
2020-08-24 11:06
codeforces
Codeforces
Round #535 (Div. 3) Nice Garland
Codeforces
Round#535(Div.3)NiceGarland这题之前死活读不懂,看别人代码后,自己写的代码又有错,对照别人代码,半天改不出来!!!真的急,测试数据太坑了,最后还是改好了。
没事码代码的渣渣
·
2020-08-24 11:56
贼坑的题目
暴力枚举
Codeforces
1389E Calendar Ambiguity(数学)
题目链接题意:一年有m个月,每月有d天,每周有w天,每年的第一天都是周一,问有多少对x,y(x#definelllonglong#defineLLlonglong#definePBpush_back#defineMPmake_pairusingnamespacestd;constintmaxn=2e5+100;constllinf=1e18+10;intmain(){intt;cin>>t;whi
lll_564
·
2020-08-24 11:50
数学
算法
Codeforces
661 E1. Weights Division(easy version)(贪心+优先队列)
题目链接思路先计算每条边被计算的次数,然后贪心地每次减半能减少最多花费的边,直到小于等于S为止。代码#include#definelllonglong#defineLLlonglong#definePBpush_back#defineMPmake_pairusingnamespacestd;constintmaxn=2e5+100;constllinf=1e18+10;lln,s,val[maxn
lll_564
·
2020-08-24 11:50
dfs
贪心
优先队列
Codeforces
660 B. Captain Flint and a Long Voyage(思维)
CaptainFlintandaLongVoyageCaptainFlintandhiscrewkeepheadingtoasavageshoreofBytelandforseveralmonthsalready,drinkingrumandtellingstories.InsuchmomentsuncleBogdanoftenremembershisnephewDenis.Today,hehas
lll_564
·
2020-08-24 11:49
二进制
思维
Solve The Maze
题目链接https://
codeforces
.ml/contest/1365/problem/D题意:比如输入3*333#B.
不爱吃代码的熊猫
·
2020-08-24 11:18
编程
Codeforces
580 D. Kefa and Dishes(状压dp)
题意:有n盘菜,现在你要吃m盘菜,每种菜只能吃一次吃第i盘菜可以得到a(i)的满足感,同时给出k条规则(x,y,c),表示如果在吃y之前刚好吃过了x,那么就会得到c的满足感,(注意x和y之间没有其他菜)问吃m盘菜的最大满足感是多少.数据范围:nusingnamespacestd;#defineintlonglongconstintmaxm=20;vector>g[20];intd[1>n>>m>>
这有点难啊
·
2020-08-24 11:17
Codeforces
22 D. Segments(贪心)
题意:在坐标轴上给定n条线段,有k个点,使这n条线段都至少有一个点在其上面(恰在端点也行)。求k的最小值,并给出一个k最小时的方案。数据范围:nusingnamespacestd;constintmaxm=1e3+5;structNode{intl,r;}a[maxm];intmark[maxm];intn;boolcmp(Nodea,Nodeb){if(a.r!=b.r)returna.r>n;
这有点难啊
·
2020-08-24 11:17
【
Codeforces
Round #496 (Div. 3)】D. Polycarp and Div 3
【
Codeforces
Round#496(Div.3)】D.PolycarpandDiv3题意:给出一个大数,数位在2e5内,然后要求我们割分这串大数,使尽可能多的数可以被3整除。
Eve_Miracle*
·
2020-08-24 11:44
CodeForces
Codeforces
Round #610 (Div. 2)-B2. K for the Price of One (Hard Version)(dp)
题目链接:B2.KforthePriceofOne(HardVersion)题目大意:有p元钱,n个商品价格分别为a1a2…an。有2种选择,第1个选择是买1个商品,第2选择是买k个商品,要求k个商品中最贵的价格不超过你手上剩余的钱。每个商品只能买1次。解题思路:很明显是个dp问题,首先我们按照价格从小到大给商品排序,dp[i]表示第i个商品花费的最少金额,每件商品有2种被购买的方式。当能买第k个
182cx
·
2020-08-24 11:07
dp
CF
CodeForces
- 1247C
Vasyawillfancyanynumberaslongasitisanintegerpoweroftwo.Petya,ontheotherhand,isveryconservativeandonlylikesasingleintegerp(whichmaybepositive,negative,orzero).Tocombinetheirtastes,theyinventedp-binaryn
ZzzzGgggHhhh
·
2020-08-24 11:07
思维
Codeforces
Round #609 (Div. 2)
A题:https://
codeforces
.com/contest/1269/problem/A题意:找到两个合数a,b,满足a-b=n。思路:直接输出9n和8n即可。
Stephencurry‘s csdn
·
2020-08-24 11:36
cf
思路
CodeForces
1201C C. Maximum Median(思维)
Youaregivenanarrayaaofnnintegers,wherennisodd.Youcanmakethefollowingoperationwithit:Chooseoneoftheelementsofthearray(forexampleaiai)andincreaseitby11(thatis,replaceitwithai+1ai+1).Youwanttomakethemedi
监心司
·
2020-08-24 11:35
Codeforces
- 375D ( dfs序 + 莫队 )
Codeforces
-375D(莫队)题目链接:https://
codeforces
.com/contest/375/problem/D题意:给出一棵n个结点的树,每个结点有一个颜色ci。
才子词人自是白衣卿相
·
2020-08-24 11:35
其他补题
Codeforces
- New Year and Handle Change
题目链接:
Codeforces
-NewYearandHandleChange直接dp的话,复杂度是n*k的。但是我们可以发现,如果我们给每次选择,一个负的代价,那么整体的最优解是一个凸包。
青烟绕指柔!
·
2020-08-24 11:03
Codeforces
动态规划
WQS二分
Codeforces
- D. Edge Deletion
Youaregivenanundirectedconnectedweightedgraphconsistingofnverticesandmedges.Let’sdenotethelengthoftheshortestpathfromvertex1tovertexiasdi.Youhavetoerasesomeedgesofthegraphsothatatmostkedgesremain.Let’
青烟绕指柔!
·
2020-08-24 11:03
Codeforces
图论
最短路
Codeforces
- D. Nature Reserve
题目链接:
Codeforces
-D.NatureReserve首先肯定二分半径。然后我们可以发现,半径确定之后,圆心肯定在一条直线上面。
青烟绕指柔!
·
2020-08-24 11:03
Codeforces
二分
计算几何
Educational
Codeforces
Round 93 (Rated for Div. 2) D. Colored Rectangles
一上来看完题目,这很贪心,马上写了发贪心,wa7!hack样例,当面临选择的数有两个相同,然后选择了某一个,可能后序的操作,得到的值不如选另一个数的价值大。1221009090903012210090309090所以正解该是dp,记录了每个状态的最优解。很容易想到状态dp[i][j][z]dp[i][j][z]dp[i][j][z]表示分别选择了i,j,zi,j,zi,j,z个棍子的最大价值。然后
nofuck~
·
2020-08-24 11:57
codeforce
dp
思维
「周练」
Codeforces
Round #530 (Div. 2)
目录一.
Codeforces
Round#530(Div.2)A.Snowball(模拟)B.SquaresandSegments(数学)C.Postcard(贪心)D.Suminthetree(dfs+
ぺ晨曦若梦ぺ
·
2020-08-24 11:55
Monotonic Renumeration
https://
codeforces
.com/contest/1102/problem/EC++版本一题解:二分先从前往后找到每个数最先出现的位置,然后从后往前找到最后出现的位置然后从头开始遍历,如果出现没有访问过的区间
STZG
·
2020-08-24 11:19
#
C++
codeforces
1059 D. Nature Reserve(几何+二分)
题目:http://
codeforces
.com/contest/1059/problem/D题意:给出n个点,要求做一个圆,使得所有点在圆内或圆上,并且该圆与x轴相切。
- Passerby ゛
·
2020-08-24 11:38
二分
几何
codeforces
1076 D. Edge Deletion(dijsktra+堆优化)
D.EdgeDeletiontimelimitpertest2.5secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenanundirectedconnectedweightedgraphconsistingofnnverticesandmmedges.Let’sdenotethe
- Passerby ゛
·
2020-08-24 11:38
最短路
模板
Codeforces
- 845G - Shortest Path Problem?(DFS + 线性基)
题目链接:https://
codeforces
.com/contest/845/problem/G7.1题意给定一个n(1≤n≤105)n(1\len\le10^5)n(1≤n≤105)个节点和m(n−
Nitrogens Xu
·
2020-08-24 11:29
图论
-
树
图论
-
最短路
数学
-
线性基
CodeForces
Round#627 D. Pair of Topics
原题链接题目D题意现在有两个数组a[1…n],b[1…n]。定义一个goodgoodgood概念:a[i]+a[j]>b[i]+b[j](ib[i]+b[j](ib[i]+b[j](i−a>-a>−a。对于小于000的差,思路是类似的。所以我们要找出每个差的对应goodgoodgood的选择范围内有多少记录,求和就可以。每一列的差我们可以在O(n)O(n)O(n)求出来,O(nlogn)O(nlo
夏弥耶
·
2020-08-24 11:54
CodeForces
Round#627 E. Sleeping Schedule
原题链接题目E题意每天有hhh个小时,定义一个goodgoodgood的概念:入睡时间在[l,r][l,r][l,r]范围内(0≤l≤rusingnamespacestd;constintMAX_N=2020;constintMAX_H=2020;intn,h,l,r;inta[MAX_N];intdp[MAX_N][MAX_H];intans;intmain(){cin>>n>>h>>l>>r;
夏弥耶
·
2020-08-24 11:54
CodeForces
- 570D Tree Requests (树上启发式合并)
CodeForces
-570D题目大意:给出一个节点u问,节点u的子树中在深度为h的节点能不能组成一个回文串。解题思路:寒假训练赛的一个题目,当时也不会,补题的时候用dfs序+二分写的。
_leon1999
·
2020-08-24 11:45
树上启发式合并
Educational
Codeforces
Round 54 D. Edge Deletion
文章目录Educational
Codeforces
Round54D.EdgeDeletion题意:分析:参考代码Educational
Codeforces
Round54D.EdgeDeletion题意:
海边拾贝的言
·
2020-08-24 11:30
Codeforces
codeforces
839D Winter is here 数论,莫比乌斯反演
D.Winterisheretimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputWinterishereattheNorthandtheWhiteWalkersareclose.JohnSnowhasanarmyconsistingofnsoldiers.Whilet
phython96
·
2020-08-24 11:25
ACM-ICPC训练题解
数论与组合数学系列
CODEFORCES训练记录
Codeforces
Round #263 (Div. 1) A B C
Codeforces
Round#263(Div.1)A:贪心。排个序,然后从后往前扫一遍,计算后缀和。之后在从左往右扫一遍计算答案B:树形DP。0表示没有1,1表示有1,0遇到0必定合并。
weixin_34415923
·
2020-08-24 11:52
Codeforces
Round #330 (Div. 1) C. Edo and Magnets 暴力
C.EdoandMagnetsTimeLimit:20SecMemoryLimit:256MB题目连接http://
codeforces
.com/contest/594/problem/CDescriptionEdohasgotacollectionofnrefrigeratormagnets
weixin_34343689
·
2020-08-24 11:47
Codeforces
Round #245 (Div. 2) C. Xor-tree DFS
C.Xor-treeTimeLimit:1SecMemoryLimit:256MB题目连接http://
codeforces
.com/contest/430/problem/CDescriptionIahubisveryproudofhisrecentdiscovery
weixin_34341229
·
2020-08-24 11:16
Codeforces
567A. Lineland Mail
Codeforces
567A的传送门AllcitiesofLinelandarelocatedontheOxcoordinateaxis.Thus,eachcityisassociatedwithitspositionxi—acoordinateontheOxaxis.Notwocitiesarelocatedatasinglepoint.Linelandresidentslovetosendle
weixin_34176694
·
2020-08-24 11:31
Asia Yokohama Regional Contest 2018 B题 - Arithmetic Progressions(dp)
https://
codeforces
.com/gym/102082题意给定一些数,可以重新排序,求其中最长的等差数列的长度思路d[i][j]表示以a[i]和a[j]为开头的等差数列的最大长度,具体见代码
weixin_34054931
·
2020-08-24 10:51
Asia Yokohama Regional Contest 2018 C题 - Arithmetic Progressions(思维)
https://
codeforces
.com/gym/102082题意求所有人从电影院的座位上逃出去的最快时间题解显然,所有人从电影院的座位上逃出去的最快时间取决于最慢的那个人,那我们可以先把每个人最快
weixin_34023863
·
2020-08-24 10:50
CodeForces
- 1059D(二分+误差)
链接:
CodeForces
-1059D题意:给出笛卡尔坐标系上n个点,求与x轴相切且覆盖了所有给出点的圆的最小半径。题解:二分半径即可。
weixin_33754913
·
2020-08-24 10:01
【
CodeForces
】889 C. Maximum Element 排列组合+动态规划
【题目】C.MaximumElement【题意】给定n和k,定义一个排列是好的当且仅当存在一个位置i,满足对于所有的j=[1,i-1]&&[i+1,i+k]有a[i]>a[j],求长度为n的好的排列数。n=n-k,那么位置j前的数字一定constintmaxn=1000010,MOD=1e9+7;intn,k,fac[maxn],fav[maxn],D[maxn],h[maxn];voidgcd(
weixin_33709219
·
2020-08-24 10:58
Codeforces
868E Policeman and a Tree
题意简述给你一颗有n个点的树,每条边有边权,有一个警察一开始在点S,他的速度是1,即通过一条长度为x的边要花x单位时间。有m个罪犯,一开始第i个在点x[i],他们的速度无限快。如果罪犯和警察到达同一个点,那么罪犯会被抓住。现在罪犯们想最大化最后一个被抓的时间,警察想最小化抓的时间。求警察抓住所以罪犯的时间的最小值题解思路dpdp[u][v][x][y]表示从u走向v,以v为根的子树有x个罪犯,其余
weixin_30919429
·
2020-08-24 10:23
上一页
84
85
86
87
88
89
90
91
下一页
按字母分类:
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
其他