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 519D dp
D.AandBandInterestingSubstringstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAandBarepreparingthemselvesforprogrammingcontests.Afterseveralyearsofdoingspo
hackssssss
·
2020-08-24 14:40
动态规划
codeforce
s 167 Div2 A
A.DimaandFriendstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputDimaandhisfriendshavebeenplayinghideandseekatDima'splaceallnight.Asaresult,Dima'splacegotmes
didi3076
·
2020-08-24 14:07
codeforce
s 161 Div2 B
B.Squarestimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputVasyahasfoundapieceofpaperwithacoordinatesystemwrittenonit.Therearendistinctsquaresdrawninthiscoord
didi3076
·
2020-08-24 14:06
codeforce
s 166 Div2 A
A.BeautifulYeartimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputItseemsliketheyearof2013cameonlyyesterday.Doyouknowacuriousfact?Theyearof2013isthefirstyearaf
didi3076
·
2020-08-24 14:06
codeforce
s 164 Div2 A
A.Gamestimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputManaoworksonasportsTV.He'sspentmuchtimewatchingthefootballgamesofsomecountry.Afterawhilehebegantonotic
didi3076
·
2020-08-24 14:06
codeforce
s 159 Div2 B
B.PlayingCubestimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputPetyaandVasyadecidedtoplayalittle.Theyfoundnredcubesandmbluecubes.Thegamegoeslikethat:theplaye
didi3076
·
2020-08-24 14:06
codeforce
s 166 Div2 C
C.Secrettimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputTheGreatestSecretEverconsistsofnwords,indexedbypositiveintegersfrom1ton.Thesecretneedsdividingbetwee
didi3076
·
2020-08-24 14:06
ui
CodeForce
s 165B - Burning Midnight Oil(二分)
B.BurningMidnightOiltimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputOnedayahighlyimportanttaskwascommissionedtoVasya—writingaprograminanight.Theprogramconsi
coco430
·
2020-08-24 13:53
CodeForces
二分
CodeForce
s 165C - Another Problem on Strings
C.AnotherProblemonStringstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAstringisbinary,ifitconsistsonlyofcharacters"0"and"1".Stringvisasubstringofstringwi
coco430
·
2020-08-24 13:21
杂题
CodeForces
CodeForce
s 160B - Unlucky Ticket
B.UnluckyTickettimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputEachofyouprobablyhasyourpersonalexperienceofridingpublictransportationandbuyingtickets.Aftera
coco430
·
2020-08-24 13:21
杂题
CodeForces
codeforce
s 628D 数位dp
题意是给你两个长度相等的串,长度为n,求两串间满足条件的串的个数。一个串满足条件当且仅当奇数位不为d,偶数为为d,且串对应的数字可以被m整除。很典型的数位dp。手残调了一个小时…老是忘掉取模思路:dp[i][j][1]表示前i位形成的数字,模m为j,且到达串前缀的上限的个数,dp[i][j][0]表示没有达到前缀的上限然后按位数转移,讨论奇偶的情况。#include#include#include
buptbh
·
2020-08-24 13:36
dp
codeforce
s #165 div2
//div2A#includeintmain(){inti,j,n,T;scanf("%d",&T);while(T--){scanf("%d",&n);if(n>=180||nintx[100005];intmain(){//freopen("input.txt","r",stdin);intn,i;scanf("%d",&n);intsum=0;for(i=0;i=0;i--)if(x[i]>
jkxqj
·
2020-08-24 13:38
【编程题】
训练日记7.23
一、训练赛B-
Codeforce
s1216A.Prefixes(AC)题意:给一个字符串(只包含字符‘a’,‘b’),要求a和b相邻,问最少改变多少次,病输出改变后的字符串思路实现:看完题就能出思路,直接暴力模拟
xh_Dopamine
·
2020-08-24 13:19
阶段总结
Codeforce
s648div2B
Codeforce
s648div2B原题:Ashishhasnelementsarrangedinaline.Theseelementsarerepresentedbytwointegersai—thevalueoftheelementandbi—thetypeoftheelement
Luo_Xubo
·
2020-08-24 13:48
Codeforces
2017 ACM - NCPC B J 题解
链接:http://
codeforce
s.com/gym/101572题意:你有n个运动员,你需要挑选4个人跑4*100m的接力,每个运动员有两个属性值,第一个值表示跑第一棒的用时,第二个值表示跑2,3
FrozenAllen
·
2020-08-24 13:05
水题合集
CodeForce
s 28D Don't fear, DravDe is kind dp
主题链接:点击打开链接为了让球队后,删除是合法的。也就是说,对于每一个车辆,l+r+c一样,按l+r+c分类。然后dp一下。#include#include#include#include#include#include#include#includeusingnamespacestd;#definellint#defineN100005structnode{intv,c,l,r;intnum;}
weixin_30919429
·
2020-08-24 12:06
CodeForce
s 234Div2
E.InnaandBinaryLogic显然对于一次更新应该一位一位的来,对于第k位的改变,通过找规律可以发现,被更新的数字数量为(k前面有多少个连续的1+1)*(k后面有多少个连续的1+1),找到这个规律时候,直接开线段树或者用set维护连续是1的区间就好了。这里我是用set写的,毕竟时间给的比较松,STL果然是方便啊。#include#include#include#include#inclu
weixin_30663471
·
2020-08-24 12:34
codeforce
s 28D(dp)
D.Don'tfear,DravDeiskindtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAmotorcadeofntrucks,drivingfromcity«Z»tocity«З»,hasapproachedatunnel,knownasTunnelof
weixin_30539625
·
2020-08-24 12:02
CF28D Don't fear, DravDe is kind 背包
题目传送门:http://
codeforce
s.com/problemset/problem/28/D题意:给你$N$个物品,每个物品有其价格$P_i$,之前必须要买的物品价格和$L_i$,之后必须要买的物品价格和
weixin_30301183
·
2020-08-24 12:30
CodeForce
s 28D Don't fear, DravDe is kind(dp)
题意:给你一些四元组(v,c,l,r),要你选出一些作为组合,不能改变相对顺序,要求是对于其中一个,l_i是之上所有c_i之和,r_i是之下所有c_i之和。要你选出的组合sum(v_i)最大。解法:因为对于一个组合来说,l_i是之上所有c_i之和,r_i是之下所有c_i之和,在加上当前的c_i,那么c_i+l_i+r_i是这个组合全部c_i之和,因此要成为一个组合,至少c_i+l_i+r_i之和得
glq007
·
2020-08-24 12:50
DP
CodeForce
s 28D Don't fear, DravDe is kind dp
题目链接:点击打开链接要使得删除后车队是合法的,即对于车队中的每辆车,l+r+c都相同,则按l+r+c分类。然后dp一下。#include#include#include#include#include#include#include#includeusingnamespacestd;#definellint#defineN100005structnode{intv,c,l,r;intnum;}c
九野的博客
·
2020-08-24 12:23
codeforce
DP
STL
1.12
Codeforce
s 28D Do not fear, DravDe is kind DP 思维
【题目地址】点击打开链接【题意】给定长度为n的四元组序列(vi,ci,li,ri)要求选出一个子序列(也就是原序列去掉若干元素后得到的序列),使得满足:•子序列中所有的四元组ci+li+ri均相等•第一个元素的li=0,最后一个元素的ri=0•第i个元素的li等于前i−1个元素的ci之和。我们的任务是,最大化选出的子序列元素vi之和。要求输出方案。【解题方法】首先,我们可以把四元组按ci+li+r
just_sort
·
2020-08-24 12:34
codeforce
s 165 Div2 A
A.FancyFencetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputEmuskaldneedsafencearoundhisfarm,butheistoolazytobuildithimself.Sohepurchasedafence-buildingrobo
didi3076
·
2020-08-24 12:15
CodeForce
s 28 D.Don't fear, DravDe is kind(dp+map)
Description给出nn辆卡车,编号11~nn,现在要从这些卡车中选出若干组成车队,以编号从小到大排,对于第ii辆卡车,其人数为cici,价值为vivi,要求其前面卡车总人数为lili,后面卡车总人数riri,问满足这些条件的车队总价值最大值Input第一行一整数nn表示车数量,之后nn行每行四个整数vi,ci,li,ri(1≤n≤105,1≤vi≤104,1≤ci≤105,0≤li,ri≤
v5zsq
·
2020-08-24 12:18
Code
Forces
dp
杂题
CodeForce
s 28D Don‘t fear, DravDe is kind (dp)
题意:给出n辆卡车,编号1~n,现在要从这些卡车中选出若干组成车队,编号从小到大排,对于第i辆卡车,其人数为ci,价值为vi,要求其前面卡车总人数为li,后面卡车总人数ri,问满足这些条件的车队总价值最大值。题解:dp对于被选的车,其前面车的总人数+后面车总人数+这辆车的人数即所选车总人数,为定值,故把所有li+ci+rili+ci+rili+ci+ri值相同的车拿出来单独考虑。由于总人数固定,考
gongyuandaye
·
2020-08-24 12:46
#
简单dp
dp
Codeforce
s Round #453 (Div. 2)A,B,C
A.VisitingaFriendtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputPigisvisitingafriend.Pig'shouseislocatedatpoint0,andhisfriend'shouseislocatedatpointmonanaxi
黑猫爱白猫
·
2020-08-24 12:49
codeforces
codeforce
s 917B. MADMAX
B.MADMAXtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAsweallknow,Maxisthebestvideogameplayeramongherfriends.Herfriendsweresojealousofhers,thattheycreateda
让我改变你的心智
·
2020-08-24 12:12
DP
codeforces
2018.10.04【
CodeForce
s1060】D. Social Circles(贪心)
传送门解析:有毒吧这道题。。。又是一道思维题。。。思路:最开始考虑的是先将所有人单独成一个圈,再考虑如何合并减小答案。然而蒟蒻不知道如何维护。。。所以我们为什么要维护?先给出大致结论:我们直接选择左走最大和右走最大合并起来,将他们作为一个新的节点,再丢回去考虑,知道不能更优为止。考虑怎么重叠能够使答案最小。其实很简单,左走最大的那个人,他左边不可能有小于限制那么多的凳子,那么我们选择右走最大的那个
zxyoi_dreamer
·
2020-08-24 12:40
贪心
2018.10.04【
CodeForce
s1060】C. Maximum Subrectangle(贪心)
传送门解析:这道题直接模拟是O(n3m3)O(n^3m^3)O(n3m3)的,怎么乱搞都搞不动。其实直接模拟的话,有很多状态是显然不够优的我们实际上可以将矩阵元素和转化一下:∑i=x1x2∑j=y1y2ci,j=∑i=x1x2∑j=y1y2ai×bj\sum_{i=x_1}^{x_2}\sum_{j=y_1}^{y_2}c_{i,j}=\sum_{i=x_1}^{x_2}\sum_{j=y_1}^
zxyoi_dreamer
·
2020-08-24 12:40
贪心
D. Dima and Lisa
https://
codeforce
s.com/problemset/problem/584/DDimalovesrepresentinganoddnumberasthesumofmultipleprimes
小菜鸡加油
·
2020-08-24 12:38
数论
B. Edge Weight Assignment
https://
codeforce
s.com/problemset/problem/1338/BYouhaveunweightedtreeofnnvertices.Youhavetoassignapositiveweighttoeachedgesothatthefollowingconditionwouldhold
小菜鸡加油
·
2020-08-24 12:38
奇数偶数性
构造
思维
A. Garland
https://
codeforce
s.com/problemset/problem/1286/A//cin.tie(0);std::ios::sync_with_stdio(false);//LLn;cin
小菜鸡加油
·
2020-08-24 12:06
dp
线性dp
Codeforce
s Round #370 (Div. 2) E. Memory and Casinos
E.MemoryandCasinostimelimitpertest4secondsmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputTherearencasinoslinedinarow.IfMemoryplaysatcasinoi,hehasprobabilitypitowinandmovetothecasi
zstu_zy
·
2020-08-24 12:06
算法理解
[
Codeforce
s 868E] Policeman and a Tree
题目大意一棵nn个节点的树,有一个警察初始在ss点,速度为11,树上分布有mm个罪犯,速度为任意大,如果罪犯和警察在同一个地方就被干掉了,警察希望干掉罪犯的时间尽量短,而罪犯希望最大化这个时间,假设每个人都以最优策略行动。求这个时间,如果警察不能干掉所有罪犯,那么输出”Terroristswin”。数据范围1≤n,m,wi≤501≤n,m,wi≤50,wiwi为边权1 ≤xj ≤n,xj ≠ s1
zmy_wky
·
2020-08-24 12:34
动态规划
Codeforce
s 1367D Task On The Board
算法讨论仔细观察一下,给出这个sss无所谓,其实统计下没个字母的个数即可,然后就是看如何构造了,可以看到就是000必然是最大的那个,然后根据000可以找到第二大的字母的所有位置,接着再找第三大的,我刚开始走了误区,我以为把这个sumsumsum排个序,然后从前到后统计统计,之后发现有很大问题,不如就像个集合那样,一个一个扩展进去,最多也就是n3n^3n3的算法,之后就简单了,直接统计第几大的字母个
肘子zhouzi
·
2020-08-24 12:51
日常code
Codeforce
s 1368D AND, OR and square sum
Codeforce
s1368DAND,ORandsquaresum算法讨论起初的想法很简单,就是可以把所有数按从大到小排个序,然后就从左到右每个数依次考虑,到了第iii个数时,可以想到的是从高位考虑低位
肘子zhouzi
·
2020-08-24 12:51
日常code
Codeforce
s 980C Posterized
题意:给了一组数,要求分成连续的组,每一组的个数不超过k,每一组中的所有数赋值成这个组里最小的数,求生成的字典序最小的数列分析:贪心。我们的目标是尽可能让给的数列里靠前面的数更小,就暴力枚举每一个数的前k个数,如果没被用过就赋值成前k个最小的数,如果前面被用了,就赋值成没被用的最小的那个,但是这样的数有可能没有用完k个,如果后面的数的前k个包含了前面的某一组没到k个的,就衔接上。代码:#inclu
Radiumm
·
2020-08-24 12:17
贪心
Codeforce
s 917D Stranger Trees
题意给出一棵n个节点的带标号树,要求对于每个k,求出有多少棵生成树满足恰好有k条边与原树相同。nintread(){intx=0,f=1;charch=getchar();while(ch'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch>=1;}returnans;}voidmod(int&x){x-=x>=MOD?MOD:0;}intC(i
ypxrain
·
2020-08-24 11:41
dp
codeforce
s 230d(最短路+预处理)
链接:http://
codeforce
s.com/problemset/problem/230/D题意:n个点m条边现在你找到从1到n的最短路,但是这里有一个限制就是如果你在时间t到达节点u如果有其他人也在这个时间到节点
yjt9299
·
2020-08-24 11:35
最短路
CodeForce
s 1076E Vasya and a Tree(树上差分+树状数组)
原题地址:https://
codeforce
s.com/contest/1076/problem/E题意:给出一棵树,有mmm次操作,每次操作有一个v,d,x,v,d,x,v,d,x,表示将以vvv为根节点
yiqzq
·
2020-08-24 11:33
ACM_数据结构
CodeForce
s - 1060C(前缀和+思维)
题意:有一个长度为n的a数组和长度为m的b数组,让这个一维矩阵相乘得到二维的矩阵,求最大子矩阵的和小于或等于x。题解:有一道原题,区间范围是1000,时间复杂度是O(n^3),用在这里会超时。(Hihocoder1502:最大子矩阵)我们可以发现一个规律:一个子矩阵的和就是(a[i]+a[i+1]+...+a[j])*(b[i]+b[i+1]+...+b[j])。所以我们可以使用前缀和求一个子矩阵
曾英俊
·
2020-08-24 11:52
codeforces题解
Codeforce
s 570D Tree Requests
Codeforce
s570DTreeRequestsdsuontree题意给一棵树,每个节点有一个字母。一些查询Q(x,d),查询x及其子树中,与根节点距离为d的所有字母是否可以构成回文串。
xzxxzx401
·
2020-08-24 11:46
dsu-on-tre
2017暑假
数据结构
线段树
codeforce
s 245C Game with Coins
DescriptionTwopiratesPolycarpusandVasilyplayaveryinterestinggame.Theyhavenchestswithcoins,thechestsarenumberedwithintegersfrom1ton.Chestnumberihasaicoins.PolycarpusandVasilymoveinturns.Polycarpusmoves
xtulollipop
·
2020-08-24 11:03
贪心
Codeforce
s 1076D - Edge Deletion - 思维
Codeforce
s1076D-EdgeDeletion-思维题解链接https://lucien.ink题目链接http://
codeforce
s.com/contest/1076/problem/D
LucienShui
·
2020-08-24 11:02
Codeforces
题解
ACM
思维
图论
Codeforce
s Round #441 (Div. 2, by Moscow Team Olympiad) D. Sorting the Coins【规律】
题目比较难读懂,读懂之后就好写了,看一下第二组样例就可以找到规律。/************************************************Author:xiang578Email:
[email protected]
:WedNov815:53:462017FileName:cf876d.cpp*********************************
永远热血沸腾
·
2020-08-24 11:57
模拟
codeforces
Codeforce
s Round #200 (Div. 1)D. Water Tree 【dfs序+线段树】
方法1把树按照dfs序展开,用线段树维护子树和,设0表示empty,1表示filled操作1:若子树v存在0节点,则把v的父亲【in[fa],out[fa]】更新成0。然后把【in[v],out[v]】更新成1操作2:把节点v更新成0操作3:询问【st[v],ed[v]】区间内是否有0节点,没有则表示1方法2用两棵线段树维护,对于操作1,第一棵线段树区间加1,对于操作二,变空的点加1,对于操作3,
永远热血沸腾
·
2020-08-24 11:56
codeforces
数据结构
codeforce
s gym 10222A Maximum Element In A Stack
http://
codeforce
s.com/gym/102222/problem/AAsanACM-ICPCnewbie,Aishahislearningdatastructuresincomputerscience.Shehasalreadyknownthatastack
csu_xiji
·
2020-08-24 11:25
栈
Educational
Codeforce
s Round 54 D - Edge Deletion 图+贪心+dijkstra
题意:给定n个点,m条边的无向连通图,定义d[j]为1号结点到j结点的最短距离让你删去一些边,让边数剩余最多为k条,如果删边前后的两个图中d[j]相同的话,那j结点就是good点,给定的边编号1~m,现在让你给出一种删边方案,是的good点尽量多;思路:单原点最短路,我们知道剩下的边数e,最大是min(n-1,k);其实不用管剩余多少条边,按照dijkstra求最短路的过程,把前面访问到的e条边放
冰冰的小宝贝
·
2020-08-24 11:39
贪心
最短路
codefoces
CF_#302_DIV2_C
http://
codeforce
s.com/contest/544C
codeforce
s.com/contest/544/problem/C有n个人每个人写一行代码会产生ai个bug问写m行代码时不超过
x___song
·
2020-08-24 11:06
codeforces
随笔
算法
dp
1102D. Balanced Ternary String
原题链接:http://
codeforce
s.com/contest/1102/problem/D题目大意:给出一个只含0,1,2的字符串序列,长度为N,要求通过最少的变换次数(0变为1或2;1变为2或
wys5
·
2020-08-24 11:05
贪心
字符串
Codeforces
上一页
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
其他