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
-873C. Strange Game On Matrix[模拟]
C.StrangeGameOnMatrixIvanisplayingastrangegame.Hehasamatrixawithnrowsandmcolumns.Eachelementofthematrixisequaltoeither0or1.Rowsandcolumnsare1-indexed.Ivancanreplaceanynumberofonesinthismatrixwithzeroe
weixin_34290096
·
2020-09-14 21:47
AIM Tech Round (Div. 2) D. Array GCD dp
D.ArrayGCD题目连接:http://
codeforces
.com/contest/624/problem/DDescriptionYouaregivenarrayaioflengthn.Youmayconsecutivelyapplytwooperationstothisarray
weixin_34087503
·
2020-09-14 20:02
Codeforces
Round #473 (Div. 2)
A.MahmoudandEhabandtheeven-oddgametimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputMahmoudandEhabplayagamecalledtheeven-oddgame.Ehabchooseshisfavoriteintegern
weixin_33980459
·
2020-09-14 20:28
Codeforces
1016 E - Rest In The Shades
E-RestInTheShades思路:相似红色的长度等于(y-s)/y倍的A'和B'之间的fence的长度A'是p和A连线和x轴交点,B'同理交点也可以用相似求,然后lower_bound找到交点在哪里,然后通过预处理的fence长度的前缀和就可以求了,处理好边界#pragmaGCCoptimize(2)#pragmaGCCoptimize(3)#pragmaGCCoptimize(4)#inc
weixin_33953384
·
2020-09-14 20:25
codeforces
Gym 100187F F - Doomsday 区间覆盖贪心
F.DoomsdayTimeLimit:20SecMemoryLimit:256MB题目连接http://
codeforces
.com/gym/100187/problem/FDescriptionDoomsdaycomesintunitsoftime.Inanticipationofsuchasignificanteventnpeoplepreparedmvaultsinwhich
weixin_33895016
·
2020-09-14 20:20
CF1077C——Good Array题解
题目链接:http://
codeforces
.com/problemset/problem/1077/CLet'scallanarraygoodifthereisanelementinthearraythatequalstothesumofallotherelements.Forexample
weixin_30933531
·
2020-09-14 20:04
数据结构与算法
Codeforces
1029D(数论+思维)
传送门题面:D.ConcatenatedMultiplestimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenanarrayaa,consistingofnnpositiveintegers.Let'scallaconcatenationofnu
weixin_30951743
·
2020-09-14 20:04
codeforces
的一些数学题
https://
codeforces
.com/problemset/problem/1129/E这题就是一个主要的想法是变成有根树,然后自下而上确定点,每次二分未确定父亲的集合找出父亲。已写。
weixin_30929295
·
2020-09-14 20:33
CodeForces
- 730A 贪心+模拟
贪心策略:1、只有一个最大值,选着第二大的一起参加比赛减分。2、有奇数个最大值,选择三个进行比赛。3、偶数个最大值,选择两个进行比赛。为什么不把最大值全部选择?因为最多只能选五个,有可能选择完五个只剩下一个最大值,那么就会进行贪心策略1,会出错。AC代码:#include#includeusingnamespacestd;constintmaxn=1e4+1;charans[maxn][101];
weixin_30886233
·
2020-09-14 20:32
Codeforces
Round #167 (Div. 2) D. Dima and Two Sequences 排列组合
题目链接:http://
codeforces
.com/problemset/problem/272/DD.DimaandTwoSequencestimelimitpertest2secondsmemorylimitpertest256megabytes
weixin_30883777
·
2020-09-14 20:01
数据结构与算法
CodeForces
- 873B Balanced Substring(思维)
inputstandardinputoutputstandardoutputYouaregivenastringsconsistingonlyofcharacters0and1.Asubstring[l, r]ofsisastringslsl + 1sl + 2…sr,anditslengthequalstor - l + 1.Asubstringiscalledbalancedifthenumb
weixin_30877493
·
2020-09-14 20:01
数据结构与算法
Codeforces
437 B. The Child and Set
题目类型:位运算传送门:>Here#include#include#includeusingnamespacestd;typedeflonglongll;constintMAXN=10010;constintMAXM=20010;constintINF=1061109567;inlineintMax(constinta,constintb){return(a>b)?a:b;}inlineintMi
weixin_30872789
·
2020-09-14 20:01
codeforces
580D. Kefa and Dishes
timelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputWhenKefacametotherestaurantandsatatatable,thewaiterimmediatelybroughthimthemenu.Therewerendishes.Kefaknowsth
weixin_30853329
·
2020-09-14 20:00
Codeforces
Round #446 (Div. 2)
目录
Codeforces
Round#446(Div.2)A.Greed题意题解B.Wrath题意题解代码C.Pride题意题解代码D.Gluttony题意题解证明代码E.Envy题意题解代码
Codeforces
Round
weixin_30753873
·
2020-09-14 20:23
数据结构与算法
Codeforces
1027C(贪心)
传送门题面:C.MinimumValueRectangletimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouhavennsticksofthegivenlengths.Yourtaskistochooseexactlyfouroftheminsuchawayt
weixin_30707875
·
2020-09-14 20:22
codeforces
545E E. Paths and Trees(单源最短路+总权重最小)
E.PathsandTreestimelimitpertest:3secondsmemorylimitpertest:256megabytesinput:standardinputoutput:standardoutputLittlegirlSusieaccidentallyfoundherelderbrother'snotebook.Shehasmanythingstodo,moreimport
weixin_30681121
·
2020-09-14 20:50
ui
Educational
Codeforces
Round 46 (Div 2) (A~G)
目录
Codeforces
1000A.CodehorsesT-shirtsB.LightItUpC.CoveredPointsCount(差分)D.YetAnotherProblemOnaSubsequence
weixin_30613727
·
2020-09-14 20:45
数据结构与算法
CF 272E Dima and Horses 染色,dfs 难度:2
http://
codeforces
.com/problemset/problem/272/E把仇恨关系想象为边,因为度只能为0,1,2,3,所以有以下几种0,1直接放即可2:有(1,1),(0,2)两种情况
weixin_30553065
·
2020-09-14 20:12
CodeForces
- 597C Subsequences (树状数组+动态规划)
Forthegivensequencewithndifferentelementsfindthenumberofincreasingsubsequenceswithk + 1elements.Itisguaranteedthattheanswerisnotgreaterthan8·1018.InputFirstlinecontaintwointegervaluesnandk(1 ≤ n ≤ 105
weixin_30511039
·
2020-09-14 20:39
Educational
Codeforces
Round 50 [Rated for Div. 2] A. Function Height
A.FunctionHeighttimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenasetof2n+12n+1integerpointsonaCartesianplane.Pointsarenumberedfrom00to2n2ninclusiv
weixin_30482383
·
2020-09-14 20:38
Codeforces
300 E(数论)
传送门题意:让你找到一个最小的p=n!p=n!p=n!使得ppp能够式子∏i=1kai!\prod_{i=1}^{k}ai!∏i=1kai!整除,并输出nnn。题目分析:非常棒的一个题目!首先,因为要求得一个最小的满足条件的值,因此,我们不妨可以想到可以使用二分。而对于这个问题,倘若n!n!n!能够被∏i=1kai!\prod_{i=1}^{k}ai!∏i=1kai!整除,则可知,(n+1)!(n
weixin_30498921
·
2020-09-14 20:08
Codeforces
1016F Road Projects
正解思路,感觉应该是先判特殊情况,比如新建的路线可以建在于1-n无关的地方,具体判别方法见代码然后再判断旧路线两端的最大贡献值,即代码中的ans,枚举1-n线路中的每个节点i,求1-[1,i]节点的最大值和[i+1,n]-n节点的最大值,维护ans即可#include#include#include#include#include#include#include#include#include#i
weixin_30483697
·
2020-09-14 20:07
codeforces
problem 140E New Year Garland
排列组合题题意用m种颜色的彩球装点n层的圣诞树。圣诞树的第i层恰由l[i]个彩球串成一行,且同一层内的相邻彩球颜色不同,同时相邻两层所使用彩球的颜色集合不同。求有多少种装点方案,答案对p取模。只要任一位置上的彩球颜色不同,就算作不同的方案。1<=n,m<=10^6,2<=p<=10^9,1<=l[i]<=5000,Σl[i]<=10^7若只考虑一层,就是bzoj1008的越狱,但是要考虑上下两层不
weixin_30457065
·
2020-09-14 20:35
Codeforces
1118F1 Tree Cutting (Easy Version) (简单树形DP)
题目大意:给定一棵树,树上的点有0,1,2三中情况,0代表该点无色。现在需要你将这棵树割掉一些边,使得割掉每条边分割成的两部分均最多只含有一种颜色的点,即分割后的两部分不能1,2点夹杂(0的点数可以任意),问你最多能有几条这样的割点。解题分析:dfs求解出所有点以自己为根的子树i中1,2,节点的个数num1,num2,然后根据母树与子树之间的num1,num2值做差,能够得到i的另一部分的1,2,
weixin_30443895
·
2020-09-14 20:34
codeforces
上红记
突然感觉
codeforces
上红不那么难,蒟蒻其实也不会几个算法,但其实打
codeforces
只要在黄名后稳住几场(5~10场)稳定上分就可以了。。。emmm,虽然现在是2488rating。。。
weixin_30387663
·
2020-09-14 20:29
Educational
Codeforces
Round 48 D Vasya And The Matrix
EDU#48D题意:给定一个矩阵,已知每一行和每一列上数字的异或和,问矩阵上的数字是多少,不存在则输出NO。思路:构造题,可以考虑只填最后一行,和最后一列,其中(n,m)要特判一下。其他格子给0即可。自己之前接触这类题目较少,感觉写这种题,自己的智商都提高了。#include#include#include#include#include#include#include#include#inclu
weixin_30337251
·
2020-09-14 20:28
c/c++
codeforces
633C. Spy Syndrome 2 hash
题目链接C.SpySyndrome2timelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAfterobservingtheresultsofSpySyndrome,Yashrealisedtheerrorsofhisways.Henowbelievesthatasup
weixin_30300225
·
2020-09-14 20:24
Codeforces
Round 544(Div. 3)
layout:posttitle:
Codeforces
Round544(Div.3)author:"luowentaoaa"catalog:truetags:mathjax:true-
codeforces
R芮R
·
2020-09-14 20:24
Codeforces
Round #198 (Div. 2)E题解
E.IahubandPermutationsIahubissohappyaboutinventingbubblesortgraphsthathe'sstayingalldaylongattheofficeandwritingpermutations.IahubinaisangrythatsheisnomoreimportantforIahub.WhenIahubgoesaway,Iahubinac
weixin_30270889
·
2020-09-14 20:23
codeforces
580D Kefa and Dishes
传送门:http://
codeforces
.com/problemset/problem/580/d思路:状压DP,f[i][j]表示最后一个为i,已选取的菜的状态为j。
weixin_30266829
·
2020-09-14 20:53
Codeforces
215D. Hot Days(贪心)
题意有nnn个地区和mmm个学生,在第iii个地区时,车上有kik_iki个学生,车内温度(当前城市的温度tit_iti+当前车上的学生kik_iki)不能超过TiT_iTi,否则,赔偿每个学生xix_ixi元,没经过一个地方,要花费costicost_icosti元,求通过nnn个地区所需要的最少花费(车上可以坐无限多的人,每经过一个地方,学生可以不坐在车上)思路如果当前城市的温度tit_iti
_执念_
·
2020-09-14 20:09
Codeforces
贪心
CodeForces
- 1367
CodeForces
-1367A-ShortSubstrings很显然前两个字母都取之后隔一个取一个chars[maxn],ans[maxn];intt;intmain(){scanf("%d",&t)
w_uxidixi
·
2020-09-14 20:07
Codeforces
Codeforces
580D Kefa and Dishes
题意:给你n道菜吃,每道菜都能获得a[i]个满意度,此外还有m个规则,在吃y之前吃x能多获得c的满意度,问你如何点菜能获得最多的满意度。思路:看到n只有18,而且还要求最多的满意度。直接状压DP,dp[i][j]表示当前正要吃第i道菜,且状态为s。然后只要三重循环枚举。一重枚举状态s,从0~(1#include#includeusingnamespacestd;typedef__int64LL;c
金金金金鑫
·
2020-09-14 20:35
2016个人训练赛1
codeforces
#343 E. Famil Door and Roads (最近公共祖先LCA+一点点概率)
题目:http://
codeforces
.com/contest/629/problem/E题意:给定一棵n(nusingnamespacestd;typedeflonglongLL;typedefunsignedlonglongULL
w20810
·
2020-09-14 20:34
ACM-数据结构
ACM-数学
Educational
Codeforces
Round 48 - C - Vasya And The Mushrooms(分类讨论 + 模拟 + 预处理)
Educational
Codeforces
Round48-C-VasyaAndTheMushrooms题意:Vasya's然后采蘑菇,蘑菇在一条路上,这条路可以看作是2*n个格子,即路有两行,n列,每次只能走相邻的格子
vloai
·
2020-09-14 20:34
CodeForces
660E Different Subsets For All Tuples(动态规划)
题意:给出一个有m个字符组成的所有长度为n的字符串的集合,现在问每个字符串的不同子串之和是多少。思路:首先用dp[I]表示长度为n的所有字符串的子串数量,假设当前已经处理了长度为i1的字符串集合,现在要处理长度为I的字符串集合考虑在长度为I-1的字符串集合的每一个字符串后面加一个字符那么数量增加了dp[I-1]-dp[lastpos-1],lastpos是当前字符出现的最后一个位置比如当前last
godspeedkaka
·
2020-09-14 20:23
程序设计竞赛
codeforces
动态规划
codeforces
275D - Zero Tree树形dp
这个题一开始做的时候有一念想到树形dp然后被自己那想歪的思路直接给带成了递归,当时没能考虑到把加减分开直接abs累加了惭愧惭愧D.ZeroTreetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAtreeisagraphwithnverticesandexactl
夜雨声訉
·
2020-09-14 20:12
dp
Codeforces
520E. Pluses everywhere 数学
520E-Pluseseverywhere/521C-PluseseverywhereIdea:EndagorionPreparation:gchebanov,DPR-pavlinConsidersomewayofplacingallthepluses,andasingledigitdi(digitsinthestringarenumberedstartingfrom0fromlefttorigh
码代码的猿猿的AC之路
·
2020-09-14 20:09
数学
Good Bye 2014 E. New Year Domino
Codeforces
500E.NewYearDomino这一题可以用在线做,但是我还没想清楚怎么维护....之前说只能离线做简直是打脸可以用类似DP的思路,前面k-1个多米诺到第k个的决策最优,再计算从前
SuPhoebe
·
2020-09-14 20:38
数据结构
&
hash
Codeforces
Round #306 (Div. 2) D.E. 解题报告
D题:RegularBridge乱搞。构造这题乱搞一下就行了。构造一个有桥而且每个点的度数都为k的无向图。方法很多,也不好叙述。。代码如下:#include#include#include#include#include#include#include#defineINF0x3f3f3f3f#defineLLlonglongconstintmod=1e9+7;usingnamespacestd;i
Aerolite坠落
·
2020-09-14 20:38
瞎搞题
Codeforces
500E. New Year Domino 倍增/线段树+离线
E.NewYearDominotimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputCelebratingthenewyear,manypeoplepostvideosoffallingdominoes;Here'salistofthem:https://www.you
码代码的猿猿的AC之路
·
2020-09-14 20:37
想法技巧
DP
数据结构
Codeforces
520C. DNA Alignment 找规律
等价于一个不左移一个左移然后结果乘上n,也就是第二个串的每个字符都会和第一个串的某个字符配对一次,所以选择出现次数最多的字符更好.如果有多个字符出现次数都是最多的,结果为最多的字符种类数的n次方C.DNAAlignmenttimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardout
码代码的猿猿的AC之路
·
2020-09-14 20:37
组合数学
想法技巧
Codeforces
466 D. Increase Sequence
一道不错的想法题。。。。。D.IncreaseSequencetimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputPeterhasasequenceofintegersa1, a2, ..., an.Peterwantsallnumbersinthesequenceto
码代码的猿猿的AC之路
·
2020-09-14 20:06
DP
Codeforces
540E Infinite Inversions 离散化+树状数组
题意:有一个无限长序列。进行n次操作,每次把下标为i,j的两个值交换。最后问你整个序列的逆序数的个数。思路:求逆序数分为两部分。一部分是交换过位置的,另一部分是没有交换过的。第一部分:用map处理n次操作后的情况。离散化后,利用树状数组求出交换过的位置的逆序数的个数。第二部分:看一个样例:21695得到的序列为623491785首先对于数值6,其下标为1。在区间[1,6]中,共有6个数。减去该区间
u011580493
·
2020-09-14 20:50
数据结构——树状数组
线段树
OJ——Codeforces
codeforces
数据结构
树状数组
Codeforces
623B:Array GCD
B.ArrayGCDtimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenarrayaioflengthn.Youmayconsecutivelyapplytwooperationstothisarray:removesomesubsegment(
2997ms
·
2020-09-14 20:10
Codeforces
dp-简单dp
Codeforces
Round #274 B. Towers
题目链接:http://
codeforces
.com/contest/479/problem/B题意:给你n个数,最多经过k次操作(每次操作对两个数,一个数加1,另一个数减1)问在不超过k次操作的过程中
o詤o訁o
·
2020-09-14 20:03
ACM
Codeforces
23E (大数乘法+树形dp)
把一颗树分成几个联通块后的大小乘积最大。dp[i][j]表示第i个节点下面有j-1个儿子的乘积最大值。//树形dp一般从最上面递归到最下面,然后往上转移。importjava.util.*;importjava.io.*;importjava.math.*;publicclassMain{staticBigIntegerdp[][]=newBigInteger[705][705];//表示第i个节
ThreeWater-
·
2020-09-14 20:25
树形dp
CodeForces
990D. Graph And Its Complement
题目:点击打开链接题意:给定a,b.要求构造一个邻接矩阵,对应的图中,有a个联通块;对应的补图有b个联通块。分析:a>1,那么b一定为1.说明a,b中至少有一个是1.特判构造a>1,前a-1个独立,为a-1个联通块;[a+1,n]顶点为一个联通块a==1,b>1.构造补图的,再返回来a==1,b==1.n=1成立,n=2,n=3不成立.n>=4,就是一个链构造题做的太少了,看到这题毫无思路。我的代
Self-Discipline
·
2020-09-14 20:50
ACM
codefoces
构造
思维
图论
规律
Codeforces
1253 F. Cheap Robot —— 想法,dijkstra+kruskal重构树+并查集+树链剖分+lca,有丶东西
Thisway题意:给你一张大小为n的图,并且点1~k是充电站。有q个询问,每次询问你从a走到b最少需要的电池大小为多少。假设你当前电量为c,当走过一个权值为w的边时,你的点会变成c-w,如果这个点是充电站,那么你的电量会便会变回电池容量。问你你每次需要的电池容量最小是多少。题解:有一说一,这道题很厉害。首先先用dijkstra找到每个点距离它最近的充电站的距离,然后的话我们可以知道,如果一条边要
天翼之城*
·
2020-09-14 20:50
想法
树链剖分
最小生成树
贪心练习 again (
codeforces
系列)
codeforces
415B.MashmokhandTokenshttp://
codeforces
.com/problemset/problem/415/BBimokhisMashmokh'sboss.Forthefollowingndayshedecidedtopaytohisworkersinanewway.Atthebeginningofeachdayhewillgiveeachworker
theArcticOcean
·
2020-09-14 20:17
algorithm_贪心
上一页
53
54
55
56
57
58
59
60
下一页
按字母分类:
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
其他