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
914F. Substrings in a String(bitset)
比赛的时候怎么没看这题啊...血亏TT对每种字符建一个bitset,修改直接改就好了,查询一个区间的时候对查询字符串的每种字符错位and一下,然后用biset的count就可以得到答案了。。。#include#include#include#include#include#include#definelllonglongusingnamespacestd;constintmaxn=100010,i
weixin_30456039
·
2020-08-23 03:51
CodeForces
56E-Find the Path(技巧)
DescriptionVasyaisinterestedinarrangingdominoes.Heisfedupwithcommondominoesandheusesthedominoesofdifferentheights.Heputndominoesonthetablealongoneaxis,goingfromlefttoright.Everydominostandsperpendicul
HonniLin
·
2020-08-23 03:07
杂题
Codeforces
Round #260 (Div. 2)-A,B,C
A.Laptopstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputOnedayDimaandAlexhadanargumentaboutthepriceandqualityoflaptops.Dimathinksthatthemoreexpensivealaptop
HonniLin
·
2020-08-23 03:07
CF
CF
Codeforces
451D Count Good Substrings(组合数学)
题目链接:
Codeforces
451DCountGoodSubstrings题目大意:定义goodstring,就是就一个字符串的连续相同字符用一个该字符替代后,形成回文串的字符串。
JeraKrs
·
2020-08-23 03:07
CF
GRADE:C
数学-组合数学
Codeforces
Round #262 (Div. 2)解题报告
详见:http://robotcator.logdown.com/posts/221514-
codeforces
-round-262-div-21:A.VasyaandSockshttp://
codeforces
.com
robotcator
·
2020-08-23 02:29
codeforces
在编程竞赛中使用
referencehttp://
codeforces
.com/blog/entry/8387
slowlight93
·
2020-08-23 02:17
ACM.其他
codeforces
280 C Game on Tree (离散概率)
题意:给一棵树。每次等可能地选个节点,去掉其代表的子树。求消掉整棵树的期望。思路:把最终的期望看成是每个节点的期望值和。消掉一个节点有两种方式1)消去祖先2)该节点被直接选择E(u)=1*1/dep(u)+0*1/(dep(u)-1)dep(u)等于根到u的路径上的节点数voiddfs(intfa,intu,intdep){ans+=1.0/dep;for(intv:graph[u])if(v!=
slowlight93
·
2020-08-23 02:17
ACM.概率
Codeforces
Round #469 (Div. 1) B. A Leapfrog in the Array(dfs)
题目链接:http://
codeforces
.com/contest/949/problem/B理性分析之后,发现直接dfs就可以了代码:#includeusingnamespacestd;typedeflonglongll
_bibibibi
·
2020-08-23 02:40
codeforces
codeforces
#625 div.2 C. Remove Adjacent
C.RemoveAdjacentYouaregivenastringsconsistingoflowercaseLatinletters.Letthelengthofsbe|s|.Youmayperformseveraloperationsonthisstring.Inoneoperation,youcanchoosesomeindexiandremovethei-thcharacterofs(s
buct_lurker
·
2020-08-23 02:01
CF54C First Digit Law Solution
今天整一道概率dp的题来做题目链接(luogu)
codeforces
题目大意给一个数nnn,然后给出nnn行,每行lil_ili,rir_iri,代表第iii个数在区间[li,ri][l_i,r_i][
smoothset
·
2020-08-23 02:52
c++
CF362D Fools and Foolproof Road Solutions
这是一道用并查集维护,优先队列进行合并的题题目链接(luogu)
CodeForces
题意给定nnn个点mmm条边的无向图,问是否能在图里添加ppp条边使得加边后存在恰好qqq个连通分量,同时请求出边权总和最小的方案
smoothset
·
2020-08-23 02:52
c++
CF1312E Array Shrinking(区间dp模板)
题目链接(洛谷)
CodeForces
这是一道区间dp的板题题意给定一个数组,每一次对于两个相邻的数,如果他们相等,则可以将它们合并为一个数,其值为原数+1+1+1,求原数组合并完后的最小长度。
smoothset
·
2020-08-23 02:52
c++
CF455C Civilization Solution
这是一道并查集的简单维护题题目链接(luogu)
CodeForces
题意给出一棵森林,有两种操作1。1^。1。给出点xxx,输出点xxx所在的树的直径2。2^。2。
smoothset
·
2020-08-23 02:52
c++
CF319C Kalila and Dimna in the Logging Industry Solution
这是一道单调队列的板题题目链接(Luogu)
Codeforces
题意伐木工人用电锯伐木,一共需要砍nnn棵树,每棵树的高度为aia_iai,每次砍伐只能砍111单位高度,之后需要对电锯进行充电,费用为当前砍掉的树中最大
smoothset
·
2020-08-23 02:52
c++
Irrigation【
codeforces
1181D】【可持久化线段树维护第K小+二分搜索】
Codeforces
Round#567(Div.2).DD.Irrigationtimelimitpertest2.5secondsmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputMishawasinterestedinwaterdeliveryfromchildhood.That'swhyhismothers
Andres_Lionel
·
2020-08-23 02:56
数据结构
线段树
【
Codeforces
Round #547 (Div. 3) G】Privatization of Roads in Treeland【树上贪心问题】
题意:现在要对一颗树上的边进行染色。如果一个节点连接的边中有大于等于两条颜色相同,则这个节点为不好的点。现在最多只能有kkk个不好的点,问最多需要几种颜色可以将树上所有的边进行染色。思路:比赛的时候前面几题写太慢了,导致没有写到这一题,还是太弱…哭。我们来考虑这道题如何解决。首先既然有kkk个不好的点,一个直接的想法就是让前kkk个度数最大的点成为不好的点,然后我们可以发现对于第k+1k+1k+1
Gene_INNOCENT
·
2020-08-23 02:23
#
思维题
基础算法及操作
CF Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)(C D E F题解)
CodeForces
,Manthan,Codefest19(部分题解CDEF)题目链接(比赛的时候,先是解了A,B,然后看C,中途一度想放弃,后来突然乱写一波过了,就去写D,感觉有思路,但是还是时间不够
摇摇乐
·
2020-08-23 02:08
Codeforces
贪心
数据结构
Codeforces
914C
题目链接:http://
codeforces
.com/contest/914/problem/C题面:题意:给出一个数(二进制形式),每次将他变成他的二进制表示中1的个数,问有多少个数可以正好在K此变化成为
做不完的ACM
·
2020-08-23 02:11
CF日常
DP
数位DP
组合数学
Codeforces
Round #469 (Div. 2) D. A Leapfrog in the Array (思维)
#includeusingnamespacestd;intmain(){longlongn;intm;cin>>n>>m;longlongx;for(inti=1;i>x;while(x%2==0)x+=n-x/2;cout<<(x/2)+1<<endl;}return0;}
_TianZhirui
·
2020-08-23 02:05
codeforces
找规律
codeforces
429B B. Working out 详解(dp)
D.Workingouttimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputSummeriscoming!It'stimeforIahubandIahubinatoworkout,astheybothwanttolookhotatthebeach.Thegymwher
键盘里的青春
·
2020-08-23 02:18
CF
线性DP
ACM
codeforces
429B B. Working out(dp)
题目链接:
codeforces
429B题目大意:给出一个矩阵,一个人从左上角走到右下角,一个人从左下角走到右上角,两个人只会在一个点相交,问两个人经过路径上的数的和最大的情况下最大和是多少。
黎辰
·
2020-08-23 02:48
codeforces的dp专题
codeforces
571B B. Minimization(dp)
题目链接:
codeforces
571B题目大意:给出一个序列,可以任意调整序列的顺序,使得给出的式子的值最小∑k=1n−k|ai−ai+k|题目分析:我们知道通过递增k可以得到一条链,那么我们就能够得到
黎辰
·
2020-08-23 02:48
codeforces的dp专题
Codeforces
280C Game on Tree 概率dp 树上随机删子树 求删完次数的期望
题目链接:点击打开链接题意:给定n个点的一棵树每次操作随机选任意一个点,把这个点和这个点的子树删去。当把所有点删去则停止。问操作次数的期望。题解引用自:点击打开链接删除的规则拥有一个非常好的性质:对于任意(u,v),选择u会导致删除v,那么选择u会删除的点集合一定包含选择了v以后会删除的点集合。我们考虑换一种方式来实现删除的过程:产生一个随机的1-n的排列P,从前往后依次尝试删除这些点,如果当前点
九野的博客
·
2020-08-23 02:31
概率DP
期望
Codeforces
Round #664 (Div. 2) C
害,这个题目被hack掉了,真难受啊,害的我掉了60多分,菜鸡如我到现在还没有上蓝,我太菜了。这个题目的做法就是暴力枚举,首先得预处理出每个ai和每个bi&的值,然后就开始暴力枚举答案从0到(1=a&&c>=b,所以如果枚举的答案是k那么k|ci#include#include#include#include#include#include#include#include#include#incl
qcccc_
·
2020-08-23 02:53
acm暑训
codeforces
Codeforces
632F Magic Matrix 题解
题意给你一个n阶矩阵,问是否满足下列条件,aij=aji,aii=0,aij≤max(aik,ajk)思路先做前两个条件的判断,如果需要判断第三个条件,可以使用bitset,按值从小到大插入,记录对于每一行有哪一位比现在的小,再看现在这个数的i和j,对第i行和第j行取交,如果不为空,就不符合条件,如果所有检查完都没问题就符合条件代码#include#include#includeusingname
DarkoDu
·
2020-08-23 01:05
Codeforces
(Educational
Codeforces
Round 9)Magic Matrix(最小生成树)
MagicMatrixtimelimitpertest5secondsmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputYou’regivenamatrixAofsizen × n.Let’scallthematrixwithnonnegativeelementsmagicifitissymmetric(soai
LzyRapX
·
2020-08-23 01:59
codeforces
CodeForces
280C Game on Tree 概率
题目链接:http://
codeforces
.com/problemset/problem/280/C推荐阅读博客:http://blog.csdn.net/qq574857122/article/details
latstars
·
2020-08-23 01:58
------数学------
Codeforces
632F Magic Matrix
传送门题目大意给定一个n×n的矩阵,若满足以下条件则称其为MagicMatrix:ai,i=0.ai,j=aj,i.∀i,j,k,s.t.ai,j≤max(ai,k,aj,k).判断给出的矩阵是否为Magic.1≤n≤2500,0≤ai,j#include#include#include#include#include#include#include#include#include#include
kyleyoung_ymj
·
2020-08-23 01:47
题目解读
Codeforces
数据结构
---bitset
Codeforces
1181 D Irrigation 题解(树状数组+倍增)
题目:CF1181D.题目大意:有一个长度为mmm的计数数组aaa,初始均为000,并给定nnn个操作xxx表示让a[x]a[x]a[x]加111.现在还有一些操作,一个操作是在a[i]a[i]a[i]中找一个最小的位置ppp(有多个则去最小的满足条件的ppp),使得a[p]a[p]a[p]加111.现在有qqq个询问,问第kkk个操作(前nnn个操作也算入)时的ppp.1≤n,m,q≤5∗105
hezlik
·
2020-08-23 01:11
Codeforces
Round #561 (Div. 2) ABCDE
传送门A.SilentClassroom水题。#includeusingnamespacestd;#definelllonglongmapmp;intmain(){intn;cin>>n;for(inti=1;i>s;mp[s[0]]++;}llans=0;for(chari='a';i1){if(mp[i]%2){//coutusingnamespacestd;#definelllonglong
henucm
·
2020-08-23 01:56
CF
期望的线性性(可加性)【
CodeForces
280c】【bzoj3036】【bzoj2134】
...好像题有点古老了bzoj那道都不见了都没法去交了只好贴别人的代码了大佬博客
Codeforces
280c题意给出一棵含n个白点的有根树,每次随机选择一个还没有被染黑的节点,将这个节点和这个节点子树中的所有点染黑
henucm
·
2020-08-23 01:56
期望的线性性
Codeforces
Round #389 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 3) 总结
这场真是GG,比赛的时候就写出了三道题,还都比较水(可怜的standing才2000QωQ)。A.SantaClausandaPlaceinaClass题意:有一个n*m的区域,每个位置有一个桌子,桌子有两个座位,座位上都有数字,如图排列(一个桌子左右为相邻数字,桌子间竖向排列)。给出一个数字k,问对应的座位在第r列的第d个,以及在某桌的左面还是右面(’L’/‘R’)。解法:直接计算。先不论左/右
heheyh123
·
2020-08-23 01:53
AC自动机 fail树 线段树维护
http://
codeforces
.com/problemset/problem/163/Ehttp://acm.hdu.edu.cn/showproblem.php?
haha593572013
·
2020-08-23 01:16
Data
Structures
Dynamic
Programming
Strings
codeforces
1355 C. Count Triangles
codeforces
1355C.CountTrianglestimelimitpertest:1secondmemorylimitpertest:256megabytesinput:standardinputoutput
five_east_west
·
2020-08-23 01:53
ACM
Codeforces
11D A Simple Task 统计简单无向图中环的个数
题目表述Givenasimplegraph,outputthenumberofsimplecyclesinit.Asimplecycleisacyclewithnorepeatedverticesoredges.InputThefirstlineofinputcontainstwointegersnandm(1 ≤ n ≤ 19,0 ≤ m)–respectivelythenumberofvert
餃子
·
2020-08-23 01:19
codeforces
算法
dp
graph
codeforces
如何快速上分
我在网上看到了很多类似的问题以及许多答案,但觉得都不实用,因为像开两个号每次打rating低的什么的来涨分(比如涨到2000+之类的)一定是基于你水平可以在div2基本稳定在打进至少全球前1000,偶尔能全球前一两百名甚至几十名。也就是说,如果你水平不是太高的话,任何花里胡哨的方法可能能让你涨一点分,但绝对不能让你快速涨分。而我,根据这篇博客下面会介绍的涨分方法,今年(2020年)5月31号左右才
chenshige
·
2020-08-23 01:05
Codeforces
950D A Leapfrog in the Array
Dimaisabeginnerprogrammer.Duringhisworkingprocess,heregularlyhastorepeatthefollowingoperationagainandagain:toremoveeverysecondelementfromthearray.Onedayhehasbeenboredwitheasysolutionsofthisproblem,and
bao___zi
·
2020-08-23 01:42
Codeforces
找规律
思考题
Codeforces
917F Substrings in a String - 后缀自动机 - 分块 - bitset - KMP
题目传送门传送点I传送点II传送点III题目大意给定一个字母串,要求支持以下操作:修改一个位置的字母查询一段区间中,字符串$s$作为子串出现的次数Solution1Bitset每次匹配一段,可以看成,依次考虑每个位置,匹配的位置对应的起点取交集。例如:大概就这个意思。bitset的count似乎很慢,可以用__builtin_popcount来数中间的位数,然后暴力数两端的位数会快很多。感觉手写倍
adx33526
·
2020-08-23 01:18
Codeforces
1181D Irrigation
Irrigation把询问离线,从小到大解决,转换成求第k大的问题,套个平衡树就好啦。#include#include#defineLLlonglong#defineLDlongdouble#defineullunsignedlonglong#definefifirst#definesesecond#definemkmake_pair#definePLLpair#definePLIpair#def
afd5154
·
2020-08-23 01:47
CF1399B Gifts Fixing
原题链接:http://
codeforces
.com/problemset/problem/1399/BGiftsFixingYouhavengiftsandyouwanttogiveallofthemtochildren.Ofcourse
ShadyPi
·
2020-08-23 00:59
杂============
贪心
CF1399A Remove Smallest
原题链接:http://
codeforces
.com/problemset/problem/1399/ARemoveSmallestYouaregiventhearrayaconsistingofnpositive
ShadyPi
·
2020-08-23 00:59
杂============
贪心
CodeForces
280C Game on Tree题解理解
题目链接C.GameonTreetimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputMomijihasgotarootedtree,consistingofnnodes.Thetreenodesarenumberedbyintegersfrom1ton.Therooth
MashiroRin
·
2020-08-23 00:37
codeforces
632F. Magic Matrix (最小生成树)
You'regivenamatrixAofsizen × n.Let'scallthematrixwithnonnegativeelementsmagicifitissymmetric(soaij = aji),aii = 0andaij ≤ max(aik, ajk)foralltriplesi, j, k.Notethati, j, kdonotneedtobedistinct.Determi
Herumw
·
2020-08-23 00:26
树形dp
bitset
codeforces
1196F K-th Path 全源k短路
网址:http://
codeforces
.com/contest/1196/problem/F题意:求一个无向无环无重边的连通图的全源$k$短路。
FairyTail0423
·
2020-08-23 00:37
数据结构与算法
(Educational
Codeforces
Round 9)Magic Matrix(最小生成树)★
题意:给定一个n*n的矩阵,要求你判断是否满足以下条件:(1)a[i][i]=0。(2)a[i][j]==a[j][i]&&i!=j。(3)对于任意a[i][j]=a[i][j]。O(n^2logn)#include#include#include#include#include#include#include#include#include#include#include#include#inc
Ezereal
·
2020-08-23 00:05
思维
图论—MST
【
CodeForces
-280C】Game on Tree(期望可加性)
outputstandardoutputMomijihasgotarootedtree,consistingofnnodes.Thetreenodesarenumberedbyintegersfrom1ton.Theroothasnumber1.Momijidecidedtoplayagameonthistree.Thegameconsistsofseveralsteps.Oneachstep,M
coldfresh
·
2020-08-23 00:26
概率与期望
Codeforces
Round 508(DIv.2) (A, B, C, D)
A模拟题解:用cnt[i][j]表示第字母i(0-25)在字符串(0-j)的出现次数。然后枚举一下cnt[i][n-1]的最小值即可。#include#include#include#includeusingnamespacestd;constintmaxn=100005;intcnt[26][maxn];chars[maxn];intn,k;boolcheck(intx,intlen){for(
elorole
·
2020-08-23 00:59
Codeforces
Manthan, Codefest 18 (rated, Div. 1 + Div. 2)(A,B,C, D)
比赛链接:http://
codeforces
.com/contest/1037A:题意:把n用尽可能少的划分,使得1-n的所有数都能表示出来(选的时候要么选一次,要么不选)比如6=1+2+3,这样就可以表示出
elorole
·
2020-08-23 00:58
Codeforces
Codeforces
#495 div.2(A, B, C)
A.模拟#includeusingnamespacestd;intn,d,ans;inta[105];intmain(){cin>>n>>d;for(inti=1;i>a[i];ans+=2;for(inti=2;i2*d)ans+=2;}cout#includeusingnamespacestd;intmain(){intn,m,l,r;scanf("%d%d",&n,&m);for(inti=
elorole
·
2020-08-23 00:28
Codeforces
Codeforces
——949B. A Leapfrog in the Array.
949B看到这个数据范围,我的第一想法是找找规律,看看最后的排列和n有没有什么关系。果不其然,有规律:奇数位置loc的值就是(loc+1)/2。偶数呢??如果忽略奇数位置的值,只看偶数位置的排列。如果n为奇数(1、3除外):例如:n=5,只看偶数位置的排列:54n=7,只看偶数位置的排列:657n=9,只看偶数位置的排列:9687n=11,只看偶数位置的排列:9711810所以,从最小的位置开始,
C画中仙
·
2020-08-23 00:38
上一页
95
96
97
98
99
100
101
102
下一页
按字母分类:
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
其他