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
Codeforce
s648div2D
Codeforce
s648div2D原题:Vivekhasencounteredaproblem.Hehasamazethatcanberepresentedasann×mgrid.Eachofthegridcellsmayrepresentthefollowing
Luo_Xubo
·
2020-08-24 07:36
Codeforces
Codeforce
s Round #503 (by SIS, Div. 2) ABC总结
首先,我个人觉得这套题比较烂。。。除了题干长以外,题目也是有一点恶心。然后重回绿名。A:给你n个相邻的建筑(从左到右编号1到n),每个建筑有h层,每个建筑的a层到b层中任意一层c层可以花一秒直接到隔壁建筑的c层。上下楼1层需要1秒。求q次查询(建筑a,层a)到(建筑b,层b)的最短时间。唯一的坑点就是同一层楼要特判。(然而我还是WA了一发)B:老师要问一个同学a,这个人会说另一个b,然后老师会批评
LSD20164388
·
2020-08-24 07:30
总结:比赛总结
[
Codeforce
s Round #514 (Div. 2)] 解题分析
Codeforce
s传送门A.Cashier题目描述Vasyahasrecentlygotajobasacashieratalocalstore.HisdayatworkisLLLminuteslong.Vasyahasalreadymemorizednnnregularcustomers
LPA20020220
·
2020-08-24 07:29
Codeforces
Codeforce
s Round #445 Div1 C:Maximum Element (组合数学+DP)
题目传送门:http://
codeforce
s.com/contest/889/problem/C题目大意:有一个函数,传一个长度为n的数组a进去,并设计一个参数k,它会用以下方式帮你找最大值:从左往右扫
KsCla
·
2020-08-24 07:27
数论
DP
好题
CodeForce
s - 1059D Nature Reserve
这道题有两种做法。首先可以知道有点在xxx轴异侧是不合法的。Solution1二分枚举半径rrr。半径定了之后,最终的圆心的纵坐标就定了。接下来考虑每个点,以每个点为圆心以rrr为半径交直线y=ry=ry=r于两点,这两点的区间就是圆心可取的区间。然后每个点的区间取一个交集就行了。但是因为checkcheckcheck函数时间太大好像不能直接过。(其实就是写的丑)另外为了精度,减少乘法即x2−y2
清秋身上攻
·
2020-08-24 07:27
#
二分
#
三分
Codeforce
s 712E Memory And Casinos 概率+线段树
点击打开链接ProblemE题意:在i点赢的概率为piwin前进一格,lose后退一格,给出两个操作操作1:修改某点的概率操作2:给出[L,R]问从L出发在R获胜的概率并且中间不走到小于L点的概率?n,qusingnamespacestd;typedeflonglongll;constintN=2e5+20;intn,q;structnode{intl,r;intmid(){return(l+r)
Masamiiiii
·
2020-08-24 07:51
CODEFORCES_
Data
Structure
【题解】
Codeforce
s Global Round 10 -- D
题目:https://
codeforce
s.ml/problemset/problem/1392/D题意n个人站成一圈,每个人有一个朝向(L或R)。每次操作可以改变一个人的朝向。
Inquisitor_
·
2020-08-24 07:16
算法
【题解】
Codeforce
s Global Round 10 -- C
题目:https://
codeforce
s.ml/problemset/problem/1392/C题意输入一串数,每次选择一串不降序列,使该序列中所有数全部+1。
Inquisitor_
·
2020-08-24 07:16
算法
数据结构
Codeforce
s Round #496 (Div. 3)
A.统计1的个数即可,注意最后一个数必定是某个台阶的最后一级也就是级数即可。#include#include#include#include#includeusingnamespacestd;intmain(){intn,i,j,k;vectorc,ans;cin>>n;if(n==1){cout>j;c.push_back(j);if(j==1)cnt++;}cout#include#inclu
HumveeA6
·
2020-08-24 07:11
Codeforces
Codeforce
s Round #531 (Div. 3) D Balanced Ternary String【模拟】
Youaregivenastringssconsistingofexactlynncharacters,andeachcharacteriseither'0','1'or'2'.Suchstringsarecalledternarystrings.Yourtaskistoreplaceminimumnumberofcharactersinthisstringwithothercharacterst
Head_Hard
·
2020-08-24 07:10
模拟
Codeforce
s Round #Pi (Div. 2) (ABCD)
A解析:水题,就是求每个数之间的距离的最大值和最小值。mycode#include#include#include#includeusingnamespacestd;constintINF=0x3f3f3f3f;constintN=1e5+10;intn;intx[N];intmain(){while(scanf("%d",&n)!=EOF){for(inti=1;i#include#includ
HelloWorld10086
·
2020-08-24 07:10
codeforce
Educational
Codeforce
s Round 85 (Rated for Div. 2)
开幕雷击,去世现场A#includeusingnamespacestd;typedeflonglongll;typedefpairpll;templateinlinevoidrd(T&x){x=0;charo,f=1;while(o=getchar(),o47);x*=f;}constintinf=~0u>>2;//1073741823constllINF=~0ull>>2;//461168601
so vegetable I am
·
2020-08-24 07:09
补题
everyday
contest
Codeforce
s Round #634 (Div. 3)
题目链接A.CandiesandTwoSistersvoidsolve(){rd(n);if(n%2==0)n--;printf("%lld\n",n/2);}爱丽丝所获得的糖范围是[(n+1)/2,n]B.ConstructtheString#includeusingnamespacestd;typedeflonglongll;typedefpairpll;templateinlinevoidr
so vegetable I am
·
2020-08-24 07:37
everyday
contest
补题
Codeforce
s Round #635 (Div. 2)
A.IchihimeandTriangle题目链接贪心就好啦,让两条长边一样长就肯定能形成三角形#includeusingnamespacestd;typedeflonglongll;typedefpairpll;templateinlinevoidrd(T&x){x=0;charo,f=1;while(o=getchar(),o47);x*=f;}constintinf=~0u>>2;//107
so vegetable I am
·
2020-08-24 07:37
补题
everyday
contest
Codeforce
s Round #608 (Div. 2)
A#includeusingnamespacestd;typedeflonglongll;typedefpairpll;templateinlinevoidrd(T&x){x=0;charo,f=1;while(o=getchar(),o47);x*=f;}constintinf=~0u>>2;//1073741823constllINF=~0ull>>2;//461168601842738790
so vegetable I am
·
2020-08-24 07:37
Codeforce
s Round #633 (Div. 2)
A#includeusingnamespacestd;typedeflonglongll;typedefpairpll;templateinlinevoidrd(T&x){x=0;charo,f=1;while(o=getchar(),o47);x*=f;}constintinf=~0u>>2;//1073741823constllINF=~0ull>>2;//461168601842738790
so vegetable I am
·
2020-08-24 07:37
补题
everyday
contest
Codeforce
s Round #623
A.DeadPixel题目链接#includeusingnamespacestd;typedeflonglongll;constintinf=0x3f3f3f3f;constintmaxn=1e9;inta,b,x,y;voidsolve(){cin>>a>>b>>x>>y;x++,y++;intn,m;n=max(a-x,x-1);m=max(b-y,y-1);printf("%d\n",max
so vegetable I am
·
2020-08-24 07:05
补题
Codeforce
s Round #609 (Div. 2)
Codeforce
sRound#609(Div.2)AEquationtimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputLet
so vegetable I am
·
2020-08-24 07:05
补题
Codeforce
s Round #379 (Div. 2) F. Anton and School
链接:http://
codeforce
s.com/contest/734/problem/F题意:给定b,c两个数组,其中b[i]=∑nj=1a[i]&a[j],c[i]=∑nj=1a[i]|a[j]。
Fsss_7
·
2020-08-24 07:32
online
judge
Codeforces
codeforces
Codeforce
s Round #643 (Div. 2) B. Young Explorers
B.YoungExplorers题目链接-B.YoungExplorers题目大意每人都有一个组队人数,值为aia_iai的人只能加入人数大于等于aia_iai个人的团,求最多能组成多少个团.解题思路贪心贪心贪心先将数列从小到大排序,然后for循环遍历用cnt计数,所此时cnt==a[i]说明能凑成一队了,直接ans++,并将cnt清零一边重新计数具体操作见代码附上代码#pragmaGCCopti
Fiveneves
·
2020-08-24 07:31
codeforces
贪心
CodeForce
s 14B Young Photographer
题目链接:http://
codeforce
s.com/problemset/problem/14/B题意:一条一维坐标轴,一个拍摄者在x0的位置,如果他在一个运动员运动的周期范围内(a1~b1),他就可以排到这个运动员
Fistice
·
2020-08-24 07:31
cf
Codeforce
s Round #503 (by SIS, Div. 2) B. Badge
Bryce1010模板https://
codeforce
s.com/contest/1020/problem/B思路:按题意模拟。
bryce1010
·
2020-08-24 07:00
【启发式合并】例题
CodeForce
s-600E(子树颜色 树上众数)+
CodeForce
s - 1009F(每层节点数的众数)+ CSU - 1811(去边后,求颜色并集大小)
例题一Lomsatgelral
CodeForce
s-600EYouaregivenarootedtreewithrootinvertex1.Eachvertexiscolouredinsomecolour.Let
Floraqiu
·
2020-08-24 07:00
图论
-
启发式合并
Codeforce
s Round #349 (Div. 2) D. World Tour
题意:给出n个点m条边的有向图,每条边的长度为1要求找出四个点a,b,c,d使得a->b+b->c+c->d的距离最大其中a->b,b->c,c->d代表两点之间的最短路径(1#include#include#include#include#include#include#include#include#include#include#include#includeusingnamespacest
Ezereal
·
2020-08-24 07:26
思维
2018.1.27【
CodeForce
s - 689B】解题报告(BFS)
B.MikeandShortcutstimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputRecently,Mikewasverybusywithstudyingforexamsandcontests.Nowheisgoingtochillabitbydoingsome
Edwardzcn
·
2020-08-24 07:25
CodeForces
BFS
CodeForce
s 377A
原来是想在填X的时候一边判断’.‘区域的连通性,发现很麻烦,说不定还超时。另一种思路是,求出’.‘的数量是cou,需要填k个’X‘,则只需要找到一个有cou-k个’.‘的连通域就可以了,剩下的k个’.‘全换成’X‘#include#include#includeintn,m,k;charmapp[510][510];intvis[510][510];intsizev=sizeof(vis);int
Daemoonn
·
2020-08-24 07:54
DFS
Codeforce
s 667C Reberland Linguistics (DP)
题意给出一个字符串,选出大于4个字符当前缀,然后把后面的字母分成2个或者3个的小字符串,要求每个字母都要包括并且在同一个分词方案里面没有连续的相同小字符串,字典序输出所有可以分出来的小字符串。思路刚开始我枚举出所有除去末尾剩一个字母的可能的后缀串,然后WA6了,然后想到有可能会有xxxxxabab这种,然后特判了一下还是WA6,然后想到xxxxxababab这样也不会有ab,然后感觉再特判一下可能
Winterfell30
·
2020-08-24 07:22
递推DP
Codeforces
CodeForce
s - 1099D(树上贪心+DFS)
题意:给出一棵有根树,根节点编号为1,每个节点存在一个权值a[x],同时还有一个s[x]为从根节点到节点x这条路径上的所有节点的a[x]之和。此时,擦除了所有深度为偶数的节点的s[x](根节点深度为1)。然后要求反推出所有节点的a[x],使得所有节点的a[x]之和最小。思路:对于叶子结点来说,权值为0就行。对于s为-1的结点来说,a[x]=s[fa]-s[x],要使得a[x]最小,那么s[x]要最
Dilly__dally
·
2020-08-24 07:20
DFS
贪心
codeforce
#514 D. Nature Reserve
D.NatureReservetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputThereisaforestthatwemodelasaplaneandlivennrareanimals.Animalnumberiihasitslairinthepoint(xi,y
Com_ice
·
2020-08-24 07:11
二分搜索
Codeforce
s Round #531 (Div. 3) E. Monotonic Renumeration(离散化+区间合并)
题意给你一个序列,要你根据这个序列构造一个新序列,要求新序列的下一个数只能与上一个数相同或为上一个数+1且原序列中相同的数,在新序列对应的位置的数也得相同在新序列第一个数恒为0的情况下,求有多少种构造序列的方式思路来源cf某神仙代码题解基础部分:显然把一个数最开始出现和最后出现的位置理解成一个区间则区间中的数均相同若区间i与区间j相交,显然i和j的数也均需相同,合并为统一区间那么就是求除了第一个数
Code92007
·
2020-08-24 07:10
组合数学(容斥原理)
[
Codeforce
s375D]Tree and Queries(dsu on the tree+bit)
题目描述传送门题意:一棵树,每个点有一个颜色,每一次询问以x为根的子树中至少出现k次的颜色有多少种题解dsuonthetree…记每一个颜色出现了多少次,再记出现多少次的颜色有多少个因为是至少出现k次,挂一个bit就行了注意bit更新的时候每一次都到最大值代码#include#include#include#include#includeusingnamespacestd;#defineN2000
Clove_unique
·
2020-08-24 07:10
题解
dsu
on
the
tree
bit
Codeforce
s 819 B. Mister B and PR Shifts - 模拟
题意:有一个无序排列,有操作使得∑ni=1|pi−i|最小。构造规则:初始时有一个排列编号为0,每次操作将排列循环右移,排列的编号+1。数据范围:2 ≤ n ≤ 106算法:考虑维护一个桶记录pi在它目标位置的左边时的距离,并且记录偏左(包括在目标位置上的点)、偏右的点的个数。利用这个桶就可以在线性时间内计算每次右移的答案。Ansi=Ansi−1−leftist+rightist−abs(pn−(
Cherries_
·
2020-08-24 07:09
Codeforces
Codeforce
s 819 D. Mister B and Astronomers 数论
题意:有T个石子,n个人,每个人轮流取石子,一颗石子只能取一次,求每个人能取到多少石子。假设i-1号取的位置为pos,那么i号取的位置就是(pos+ai)modT,如果当前位置的石子已经被取走,这个人的所取石子数量不增加,i+1取的位置为(pos+ai+ai+1)modT算法:设S=∑ni=1ai,sti=∑ni=2ai,为每个人第一次取得位置,不考虑那些第一次就取不到的人。那么每个人可以取到的就
Cherries_
·
2020-08-24 07:09
Codeforces
Codeforce
s 819 E. Mister B and Flight to the Moon
题意:给定n个点的完全图,用三元环和四元环去覆盖整张图。构造一个方案使得每条边被覆盖两次。数据范围:3 ≤ n ≤ 300算法:容易想到是要根据奇偶分别判断情况。对于较为简单奇数:将其中一个点拿出,在这里为了方便就暂时不考虑1号点。每两个点为一组,组与组之间没有重复点,如四个点为A,B,C,DA≠B≠C≠D组与组之间连边是非常简单的,在下面提供了一种方案:那么现在的问题就是组内点与点之间的连边,考
Cherries_
·
2020-08-24 07:09
Codeforces
Codeforce
s Round #535 (Div. 3) C. Nice Garland(暴力)
题目链接:http://
codeforce
s.com/contest/1108/problem/C题意是给了一个长度为n的字符串,且字符串只包含'R','B','G'三种字符,可以改变任何一个字符,使得任意两个相同的字符的距离是
Ch_zaqdt
·
2020-08-24 07:38
CodeForces
Codeforce
s Round #496 (Div. 3) B.Delete from the Left(思维)
题目链接:http://
codeforce
s.com/contest/1005/problem/B题意是给你两个字符串,对两个字符串进行删除操作,只能从最左端一个一个删,然后问一共需要删多少个能使两个字符串相同
Ch_zaqdt
·
2020-08-24 07:38
CodeForces
Codeforce
s Round #531 (Div. 3) E. Monotonic Renumeration(思维+差分数组)
题目链接:http://
codeforce
s.com/contest/1102/problem/E题意是给了n个数的a数组,要构造b数组,b数组需要满足以下三个要求,b[1]=0,如果a[i]=a[j]
Ch_zaqdt
·
2020-08-24 07:38
CodeForces
Codeforce
s Global Round 10——A.B!.C
Codeforce
sGlobalRound10A.OmkarandPassword题意:t组输入,每组n个数,数组a,可进行操作:相邻的两个值不同,则可以相加并替换掉这相邻的两个值,问最后数组剩余的长度最小值
Celavia_yu
·
2020-08-24 07:37
codeforces
思维
Codeforce
s Round #336 (Div. 1) D. Power Tree
D.PowerTreetimelimitpertest3.5secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputGenosandSaitamawentshoppingforChristmastrees.However,adifferenttypeoftreecaughttheirattention,t
CRZbulabula
·
2020-08-24 07:36
dfs
[
codeforce
s375D]Tree and Queries(dsu on the tree+bit)
题目:我是超链接题意:统计以v为顶点的子树中颜色出现大于等于k次的种类数题解:dsuonthetree!先把询问记录下来—-这里的询问记录很多都用虚树呢这里因为是至少k次,用bit就很好了,这里对于bit的处理十分巧妙,记录出现多少次的颜色种类add操作if(cnt[a[x]])change(cnt[a[x]],-1);cnt[a[x]]+=vv;if(cnt[a[x]])change(cnt[a
wwyx2001
·
2020-08-24 07:31
树状数组
dsu
on
tree
Minimum Ternary String (
CodeForce
s - 1009B)
Youaregivenaternarystring(itisastringwhichconsistsonlyofcharacters'0','1'and'2').Youcanswapanytwoadjacent(consecutive)characters'0'and'1'(i.e.replace"01"with"10"orviceversa)oranytwoadjacent(consecutiv
Baiyi_destroyer
·
2020-08-24 07:58
思维
Codeforce
s 1102D Balanced Ternary String 思维
题意:给出0,1,2序列,序列中的0,1,2数量不一样,但是0,1,2都可以被修改成其他数字,求将序列修改成0,1,2数量相等相等序列的最小修改次数,并输出修改后最小字典序的序列。思路:预处理序列的0,1,2的数字个数和位置,设0的数量是aa,1的数量是bb,2的数量是cc,此时分情况讨论:若aa==bb&&bb==cc直接输入,如果不是,使用三个双端队列,保存0,1,2元素的位置。先对2多的情况
Aya_Uchida
·
2020-08-24 07:26
ACM
cf
Codeforce
s 1102B Array K-Coloring 思维
题意:给出n个元素的数组和k个颜色,要求将所有元素都涂色,且相同元素的颜色不同,且要使用所有颜色。思路:将所有元素的位置使用vector保存,对所有元素一种接着一,种从1开始到k循环着色。着色完按照顺序输出即可。AC代码:#include#include#includeusingnamespacestd;vectorpos[5005];intcol[5005];//各个元素着色intmain(){
Aya_Uchida
·
2020-08-24 07:26
ACM
cf
构造
Codeforce
s 667C Reberland Linguistics【DFS】
题目链接:http://
codeforce
s.com/problemset/problem/667/C题意:一个串可以看成一个长度大于4的根,加上其后面的若干个相邻(inarow)不同的长度为2或3的子串组成
An55511
·
2020-08-24 07:25
CodeForce
s1076E、Vasya and a Tree(线段树+离线)
E.VasyaandaTreetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputVasyahasatreeconsistingofnnverticeswithrootinvertex11.Atfirstallverticeshas00writtenonit.Letd
Amovement
·
2020-08-24 07:55
CodeForce
s1076D、Edge Deletion (最短路+BFS)
D.EdgeDeletiontimelimitpertest2.5secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenanundirectedconnectedweightedgraphconsistingofnnverticesandmmedges.Let'sdenotethe
Amovement
·
2020-08-24 07:54
Codeforce
s Global Round 10 B - Omkar and Infinity Clock
题目链接题意:每次都用数组中的最大值减去每一个值,问你k次后的数组。思路:如果最大值固定的话,每两次是一个循环,但是在数组中有负数和没有0的情况下最大值会发生改变,所以我们将数组变为减一次之后的数组,这样数组中一定有0并且没有负数,然后以两次为一个循环判断即可。代码:#include#defineintlonglong#defineIOSios::sync_with_stdio(false);ci
ACkingdom
·
2020-08-24 07:20
思维
Codeforce
s Global Round 10 D. Omkar and Bed Wars
题目链接题意:枕头大战,RL分别代表攻击方向,每次操作可以修改一个人的方向使得枕头大战的所有人都满足逻辑:如果只有一个人打你那么你必须打他,如果两边的人都没有打你或者是都在打你那么你打谁都行。思路:我们可以很容易的判断出三个连续的R或者是L都是不允许的,所以我们只需要将RRR或者LLL的末尾变成L或R即可,这样可以合理的利用每一次操作,需要注意的是要从每一个连续的R或L开始判断,因为是成环的,所以
ACkingdom
·
2020-08-24 07:20
思维
Codeforce
s Global Round 10 C. Omkar and Waterslide
题目链接题意:每次操作可以使得一个非递减区间全部++,问你最少操作几次可以使得数组递增。思路:我们只需要让每一个递增的开头都大于上一个递增的结尾即可,因为我们每次操作都可以将这个递增结尾之后的所有数都++,这样不会影响后面的判断,也不会多++。所以具体操作就是遍历然后遇到递减的情况就将结果加上s[i-1]-s[i]。代码:#include#defineintlonglong#defineIOSio
ACkingdom
·
2020-08-24 07:20
思维
[
Codeforce
s #316 D. Tree Requests]DFS序、离线、二分
[
Codeforce
s#316D.TreeRequests]DFS序、离线、二分1.题目链接[
Codeforce
s#316D.TreeRequests]2.题意描述给定一棵N个节点的树,每个节点对应26
Xingw-Xiong
·
2020-08-24 07:49
ACM____数据结构
ACM____二分/三分
上一页
92
93
94
95
96
97
98
99
下一页
按字母分类:
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
其他