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
s 520D. Cubes 贪心模拟
每一步都取当前稳定的格子里面数字最大或者最小的数.用一个set维护当前可取的格子*begin最大*(--end)最小每删除一个格子都要对这个格子周围的6个格子进行稳定性检查一个格子上面的3个格子确定了这个格子的稳定性D.Cubestimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandar
码代码的猿猿的AC之路
·
2020-08-15 11:15
暴力/模拟
贪心
Codeforce
s Round #277 D. Valid Sets(486D) 树形dp
http://
codeforce
s.com/contest/486/problem/DD.ValidSetstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAsyouknow
neko01
·
2020-08-15 11:09
Codeforce
s Round #283 (Div. 1) A B C
A题:http://
codeforce
s.com/contest/497/problem/AA.RemovingColumnstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenann
neko01
·
2020-08-15 11:37
Codeforce
s 506D:Mr. Kitayuta's Colorful Graph 并查集
D.Mr.Kitayuta'sColorfulGraphtimelimitpertest4secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputMr.Kitayutahasjustboughtanundirectedgraphwithnverticesandmedges.Theverticesofthe
2997ms
·
2020-08-15 11:56
Codeforces
并查集
Codeforce
s 148D Bag of mice(概率dp)
题目大意:黑箱子里有w只白老鼠和b只黑老鼠,dragon和Princess轮流从箱子中拿出一只老鼠,先取到白老鼠的人赢,但是dragon每次拿的时候都会多跑出一只老鼠。思路分析:dp[i][j]表示箱子里有i只白老鼠和j只黑老鼠的时候Princess先取赢的概率。那么转移方程就有4个。分别是:直接取到白老鼠取到黑老鼠,dragon也拿到了黑老鼠,跑了一只黑老鼠。取到黑老鼠,dragon也拿到了黑老
Jinx_jinx_again
·
2020-08-15 11:53
DP
Codeforce
s Round #202 (Div. 2) B.Color the Fence
大坑题啊大坑题以为过了5222222223就对了的。结果。。。19999999568输出987哈哈哈跟上面那种是一样的原理。先刷小的。刷不够了换一个小的加剩余的看能不能凑一个大的但是凑了一个大的以后呢。可能还有余数。那就还要去凑。#include#include#include#include#include#include#include#include#definelsonnum=a[i]){
Jinx_jinx_again
·
2020-08-15 11:52
思维
Codeforce
s Round #256 (Div. 2)思维训练
B.SuffixStructuresBizontheChampionisn'tjustabison.Healsoisafavoriteofthe"Bizons"team.Atacompetitionthe"Bizons"gotthefollowingproblem:"Youaregiventwodistinctwords(stringsofEnglishletters),sandt.Youneed
u010660276
·
2020-08-15 11:52
常用技巧
二分搜索
Codeforce
s 580E Kefa and Watch 线段树
参考:http://blog.csdn.net/w703710691d/article/details/48687603代码:#include#include#include#include#include#include#include#includeusingnamespacestd;#definelllonglongconstllmod1=1e9+7;constllmod2=1e9+9;ch
xiaoyu1_1
·
2020-08-15 11:51
线段树
线段树
Codeforce
s Round #286 (Div. 2) D. Mr. Kitayuta's Technology 强连通分量 有向图求环
D.Mr.Kitayuta'sTechnologytimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputShusekiKingdomistheworld'sleadingnationforinnovationandtechnology.Therearencitiesint
相知无悔
·
2020-08-15 11:51
强连通分量&&拓扑排序
图论
模板
cf
Codeforce
s 1239 D Catowice City —— tarjan
Thisway题意:现在有n个人,n只猫,给你他们的联系,并且第i个人与第i只猫一定有联系。现在需要选出总共n个人+猫,而且至少有一个人,一只猫,问你选的人是哪些,猫是哪些题解:第一次接触tarjan,就是求强联通分量的一种方法。scc相同即在同一个强联通分量里。那么这道题为什么会扯上scc,是因为我们看到需要n个人+猫,而第i个人与第i只猫一定有联系,说明第i个人与第i只猫中一定要选一个。而如果
天翼之城*
·
2020-08-15 11:13
tarjan
想法
Kefa and Watch
CodeForce
s - 580E
http://
codeforce
s.com/problemset/problem/580/E两种操作一是将区间全部改为某个数字二是询问一个区间内的数字串是否具有周期性大体思路是线段树维护区间哈希值设周期为
sunyutian1998
·
2020-08-15 11:02
线段树/树状数组/RMQ
HASH
CodeForce
s - 920E
http://
codeforce
s.com/problemset/problem/920/E求补图的各个连通块大小智商不够直接线段树优化建图然后tarjan缩点幸好内存不紧。。
sunyutian1998
·
2020-08-15 11:02
线段树/树状数组/RMQ
强连通分量
【
Codeforce
s Round 363 (Div 2) E】【概率DP 期望DP 逆推等价法】LRU Cache替换LRU原则超多步数后每个数据在Cache中的概率
E.LRUtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputWhilecreatinghighloadedsystemsoneshouldpayaspecialattentiontocaching.Thisproblemwillbeaboutoneofthemost
snowy_smile
·
2020-08-15 11:55
题库-CF
CodeForces
动态规划-概率DP
or
期望DP
Codeforce
s-527c
Leonidwantstobecomeaglasscarver(thepersonwhocreatesbeautifulartworksbycuttingtheglass).Healreadyhasarectangularwmm × hmmsheetofglass,adiamondglasscutterandlotsofenthusiasm.Whathelacksisunderstandingof
SongOrz
·
2020-08-15 11:55
Codeforce
s 527C Glass Carving
C.GlassCarvingtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputLeonidwantstobecomeaglasscarver(thepersonwhocreatesbeautifulartworksbycuttingtheglass).Healrea
舒然---小广广
·
2020-08-15 11:23
STL
Codeforce
s Gym 101630C Connections 强连通分量Tarjan
ProblemC.ConnectionsInputfile:standardinputOutputfile:standardoutputTimelimit:3secondsMemorylimit:512mebibytesHardtimesarecomingtoByteland.QuantumcomputingisbecomingmainstreamandQubitlandisgoingtooccu
VampireWeekend
·
2020-08-15 11:51
tarjan/2-SAT
CodeForce
527C 非递归线段树 连续区间
#include#includeusingnamespacestd;constintmaxn=200010;intlsum[maxn0;i--)Pushup(i,k);}voidUpdate(intL,intk){//切割,更新ints=N[k]+L-1;pure[s][k]=lsum[s][k]=rsum[s][k]=sum[s][k]=0;for(s>>=1;s;s>>=1)Pushup(s,
傻蛋的阿简
·
2020-08-15 11:13
线段树
CodeForce
s - 427C Checkposts (强连通分量)
http://
codeforce
s.com/problemset/problem/427/C题意:一共给你NN个点,MM条有向边。
sdxtcqs
·
2020-08-15 11:41
图论
codeforce
s Volatile Kite(几何)
D.VolatileKitetimelimitpertest2secondsmemorylimitpertest256megabytesYouaregivenaconvexpolygonPwithndistinctverticesp1, p2, ..., pn.Vertexpihascoordinates(xi, yi)inthe2Dplane.Theseverticesarelistedincl
saber_acher
·
2020-08-15 11:40
几何
Codeforce
s Problem 711D Directed Roads(Tarjan判环)
此文章可以使用目录功能哟↑(点击上方[+])比赛链接→
Codeforce
sRound#369(Div.2)
Codeforce
sProblem711DDirectedRoadsAccept:0Submit
queuelovestack
·
2020-08-15 11:33
CodeForces
Codeforce
s Round #656 Div3 前四题(也许会更新
目录A-ThreePairwiseMaximumsB-RestorethePermutationbyMergerC-MakeItGoodD-a-GoodStringA-ThreePairwiseMaximums啊啊啊啊啊该死的校园网自己断开了于是我写了老半天的题解一个字都没保存再放送思路:分四种情况讨论三个数都不相等两个数相等,另一个数比这两个大两个数相等,另一个数比这两个小三个数都相等情况1、2
tcy今天长胖了吗
·
2020-08-15 11:32
CF补题总结
最短路+tarjan
codeforce
s567E President and Roads
这题出的非常有意义。题意:告诉点一个有向图,和起点s终点t。保证s能到达t。然后询问所有的边如果这条边是s到t的最短路中不能缺少的,就输出YES否则,可以将这条边的长度减小,但是最多中i能减小到1。此时最短路如果必经这条边就输出CAN减少的长度否则,就输出NO思路:先从s出发做一次最短路,保存在d1数组中。然后把边全部反转,从t出发做一次最短路,保存在d2数组中如果d1[u]+w==d1[v]且d
逍遥丶綦
·
2020-08-15 11:02
ACM_图论
Codeforce
s Round #664解题报告A~D
A、BoboniuLikestoColorBalls水题,但是写起来挺麻烦的……#include#definelllonglongusingnamespacestd;constintN=500;lla[N];intmain(){intt,n;intr,g,b,w;cin>>t;while(t--){intjs=0,os=0,a0=0;for(inti=0;i>a[i];if(i!=3){if(a[
浅梦曾倾
·
2020-08-15 11:31
CF题目
Codeforce
s Round #663 解题报告A~C
题目链接A、Suborrays水题。#includeusingnamespacestd;#definelllonglong#defineinf0x7fffffffconstintN=1e5+10;constdoublePI=acos(-1.0);constintmod=1e9+7;inta[N],vis[N],num[N];intmain(){intt,n;cin>>t;while(t--){ci
浅梦曾倾
·
2020-08-15 11:30
CF题目
Codeforce
s Round #656 (Div. 3)解题报告 A~D
题目链接A、ThreePairwiseMaximums给定x、y、z三个数,其中x=max(a,b),y=max(a,c),z=max(b,c),求出a、b、c。思维题,想了半天,根据xyz的关系来判断的,具体看代码。#includeusingnamespacestd;#definelllonglongconstintN=2e5+10;inta[N],b[N];intmain(){intt,n;c
浅梦曾倾
·
2020-08-15 11:30
CF题目
Codeforce
s Round #661 (Div. 3)
Poweredby:AB_IN局外人A.RemoveSmallest#includeusingnamespacestd;typedeflonglongll;llt,n,a[101],x;intmain(){//freopen("write.txt","w",stdout);cin>>t;while(t--){intflag=0;cin>>n;for(inti=1;i>a[i];}sort(a+1,
AB_IN 局外人
·
2020-08-15 11:29
ACM
Python3
CodeForce
s - 1270C Make Good(思维+构造)
题目链接:点击查看题目大意:给出一个由n个数字构成的数列,现在已知其累加和为sum,异或和为xor,现在允许我们向数列中添加0~3个数,以满足sum=2*xor,构造出任意一种方案题目分析:一开始我想分情况讨论的,就是在求出sum和xor之后,讨论一下其大小关系,如果sum小于2*xor的话,直接补齐两个其差值的一半就好了,因为新补的两个数对xor不做贡献,而对sum的贡献就是差值,可以满足条件了
Frozen_Guardian
·
2020-08-15 11:59
思维
构造
异或和
cf--contest1311--B. WeirdSort+冒泡排序
传送门http://
codeforce
s.com/contest/1311/problem/B题意有一个n个整数的数组,随后给出m个整数p,p是一个操作位置,也就是可以将数组中的第p个数和第p+1个数交换
^_^vito
·
2020-08-15 11:57
算法刷题库
Codeforce
s Round #560 (Div. 3) D. Almost All Divisors、C. Good String题解
D.AlmostAllDivisors题意:给出t组测试数据,每组测试数据给出n个数,这n个数是guessednumber除去本身和1以外的所有因子,输出最小的guessednumber。思路:sort排序所有因子di,将最小的因子和最大的因子相乘,得到的既是所有guessednumber(假定此数满足题意),此时再将得到的数求出所有除本身与1之外的所有因子,与题目给出的所有因子相比较,只要因子相
KKKyot_
·
2020-08-15 11:56
题解
Codeforce
s Round #557 (Div. 2) A. Zoning Restrictions Again
A.ZoningRestrictionsAgaintimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouareplanningtobuildhousingonastreet.Therearennspotsavailableonthestreetonwhichyouc
轻描淡写606
·
2020-08-15 11:25
codeforce
s round #552(div 3) C.Gourmet Cat
C.GourmetCattimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputPolycarphasacatandhiscatisarealgourmet!Dependentonadayoftheweekheeatscertaintypeoffood:onMondays,
轻描淡写606
·
2020-08-15 11:25
Codeforce
s Round #598 (Div. 3)B.Minimize the Permutation
传送门B.MinimizethePermutationtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenapermutationoflengthn.Recallthatthepermutationisanarrayconsistingofndis
轻描淡写606
·
2020-08-15 11:24
Codeforce
s Round #598 (Div. 3)D.Binary String Minimizing
传送门D.BinaryStringMinimizingtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenabinarystringoflengthn(i. e.astringconsistingofncharacters‘0’and‘1’).In
轻描淡写606
·
2020-08-15 11:24
CodeForce
s 1395C-Boboniu and Bit Operations(位运算-暴力)
题目链接:https://
codeforce
s.com/problemset/problem/1395/C博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13494811
lonely_wind_
·
2020-08-15 11:53
Codeforces
Codeforces
Codeforce
s Round #618 (Div. 2)D,E
D.Aerodynamictimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputProblemDescriptionGuy-ManuelandThomasaregoingtobuildapolygonspaceship.You’regivenastrictlyconvex
★歌神☆
·
2020-08-15 11:53
思维题
Codeforce
s Round #609 (Div. 2) B. Modulo Equality
Codeforce
sRound#609(Div.2)B.ModuloEqualityYouaregivenapositiveintegermandtwointegersequence:a=[a1,a2,
旺 崽
·
2020-08-15 11:52
Codeforces
暴力
排序
Educational
Codeforce
s Round 92 (Rated for Div. 2) B. Array Walk(dp)
B.ArrayWalktimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenanarraya1,a2,…,an,consistingofnpositiveintegers.Initiallyyouarestandingatindex1andhave
柠檬咕咕咕
·
2020-08-15 11:21
Codeforce
s Round #664 (Div. 2)
A.BoboniuLikestoColorBalls题意:总共四个颜色,可以进行的操作是,前三个一人拿一个放到第四个,就相当于前三个都减一,第四个+3+3+3。然后得到的四个数,每个数对应一种字符的个数,问这些字符是否能构成回文串。构成回文串的情况可以是个数为偶数的有四个,或者个数为偶数的有三个为奇数的有一个。还有就是全部都为奇数,然后经过一次操作前三个颜色都变成了偶数,最后一个颜色也变成了偶数,
邵光亮
·
2020-08-15 11:20
CodeForces
CodeForce
s 1165-C Good String
题目:传送门思路:可以证明的是,从头到尾直接遍历,是合理的方法.证明:如果在原串中存在多个不合理的位置,那么前面的位置一定是要被删去的,因为前面的位置不受后面位置删去的影响,而后面位置的可能因为前面位置的删去使得这个位置合理了,虽然可能前面删去会导致后面原本不合理的位置变得不合理,但是我们反过来想,如果我们不删去前面的位置,那么前面的位置就不可能合理,这显然不是我们想要的结果,所以我们先保证前面合
JingLuoZZZ
·
2020-08-15 11:48
CF200题计划
Codeforce
s 1140B - Good String (思维)
题目:传送门题意:现在给你一个只含‘’字符串,‘‘相反。现在问你在我们进行移走字符操作之前,我们最少要先删除多少个字符,才能得到一个GoodString(整个字符串只含有一个字符).思路:我们得到的GoodString无非就是两种类型,只含有’‘。那如果求得最小的删除数呢,我们先考虑我们的最优结果是只含有’’,很明显如果有‘>‘右边没有’'一定要先移走(因为我们没有能移走它的手段,有人可能会认为如
JingLuoZZZ
·
2020-08-15 11:47
CF200题计划
思维基础题
codeforce
s 1252K 线段树维护矩阵
分析对于操作一,相当于翻转,我们可以用异或去处理这个标记对于操作二,即查询[L,R][L,R][L,R]这个区间的结果对于初始值a,b{a,b}a,b,我们有x1∗a+y1∗b,x2∗a+y2∗b{x1*a+y1*b,x2*a+y2*b}x1∗a+y1∗b,x2∗a+y2∗b,即A,B{A,B}A,B其实这个操作就是一个矩阵的变化我们维护一个2×22×22×2的矩阵{ab}∗{1011}={a+b
three trees
·
2020-08-15 11:46
矩阵
线段树
Codeforce
s 1217D. Coloring Edges 拓扑排序 有向图找环
题意:给定一个有向图,可以给边染色,若图中存在环,则环中所有边不能为同一颜色,求出为了满足条件需要对边染色的最少色数,及染色方案思路:一个有向图中的边有两种情况:大的指向小的,小的指向大的。可以发现一个环中只要对这两种情况染上不同颜色,则环中必定存在两种颜色。故只需要判断给定的图是否存在环即可,若没有环,所有节点都为同一颜色;否则染色数为2,输出上述染色方案。判定有向图是否存在环可以用拓扑排序,用
Huglight
·
2020-08-15 11:41
图
拓扑排序
Codeforce
s 1133F2 Spanning Tree with One Fixed Degree【BFS+强连通分量】
传送门题意:给你一个n个点,m条边的无向图(保证两个有一条路连通),现在要求你利用这些边生成一个棵树,保证结点1的度为k。思路:我们要满足1的度为k,如果连接1边的数量小于k,那么答案肯定是NO。如果连接1边的数量大于k我们肯定要删除多余的边,但是把边删除过后,我们还要保证剩余的边还能生成一棵树。我们要判断不是通过1结点来连接的点集有多少个,其实就是先把1连接的边去掉,判断剩下的强连通分量的个数(
什么都不会的菜鸡
·
2020-08-15 11:10
图论
CodeForce
s - 339D Xenia and Bit Operations
CodeForce
s-339DXeniaandBitOperations题意:给定n和m,给你一个包含2^n个数的数组,有m次操作,每次操作先将p位置的数修改,先两两相或使数组减少一半,再两两相异或使数组再减少一半
柒月 流火
·
2020-08-15 11:09
数据结构-----线段树
【
CodeForce
s 1366A --- Shovels and Swords】思维
【
CodeForce
s1366A---ShovelsandSwords】思维题目来源:点击进入【
CodeForce
s1366A—ShovelsandSwords】DescriptionPolycarpplaysawell-knowncomputergame
私忆一秒钟
·
2020-08-15 11:09
ACM
Kefa and Watch 【
CodeForce
s - 580E】【双值哈希hash+线段树】
题目链接题意不难,给你一段长度为N的字符串,接下来就是有两种操作:一是更新一段区间让它们的值相同;二是问这个查询的区间是否符合f(i)==f(i+d),就是是否以d为周期长度。思路:确实想了挺久的,首先是字符串,这里就需要用到哈希的方式来处理,一开始哈希没弄好,错了,后来再重做时加上了取mod的操作然后就过了,还有,如何判断它是一个以d为周期长度的字符串呢?就利用f(i)==f(i+d)不就可以了
Andres_Lionel
·
2020-08-15 11:38
哈希
数据结构
【
CodeForce
s - 527C】Glass Carving(线段树或者SBT或者set)
题干:Leonidwantstobecomeaglasscarver(thepersonwhocreatesbeautifulartworksbycuttingtheglass).Healreadyhasarectangularwmm × hmmsheetofglass,adiamondglasscutterandlotsofenthusiasm.Whathelacksisunderstandin
韬光养晦_
·
2020-08-15 11:05
Codeforce~
STL
线段树
Codeforce
s Round #124 (Div. 1) D. The Next Good String
#include#defineN400100usingnamespacestd;typedefunsignedlonglongULL;constULLMOD=29;ULLcf[N],a[N];intn,m;chars[N];inlinevoidex(){puts("Impossible");exit(0);}ULLh[N];voiddfs(intp,intf,ULLh1,ULLh2){if(p==
我的妹妹syf
·
2020-08-15 11:56
贪心
codeforces
字符串
hash
Codeforce
s 196D Lexicographically Maximum Subsequence(模拟+哈希)
You'vegotstrings,consistingofonlylowercaseEnglishletters.Finditslexicographicallymaximumsubsequence.We'llcallanon-emptystrings[p1p2...pk] = sp1sp2...spk(1 ≤ p1 |y|andx1 = y1, x2 = y2, ..., x|y| = y|y
i-unique
·
2020-08-15 11:19
ACM
模拟
哈希
CodeForce
s 527C. Glass Carving 线段树
http://
codeforce
s.com/contest/527/problem/CC.GlassCarvingtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputLeonidwantstobecomeaglasscarver
IR1S
·
2020-08-15 11:18
线段树
上一页
127
128
129
130
131
132
133
134
下一页
按字母分类:
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
其他