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 611C New Year and Domino(dp)
C.NewYearandDominotimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputTheysay"yearsarelikedominoes,tumblingoneaftertheother".Butwouldayearfitintoagrid?Idon'tthi
01的世界
·
2020-09-14 19:04
Codeforces
————动态规划————
codeforce
s——873C —— Strange Game On Matrix
C.StrangeGameOnMatrixtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputIvanisplayingastrangegame.Hehasamatrixawithnrowsandmcolumns.Eachelementofthematrixisequa
lose__way
·
2020-09-14 19:32
codeforces
codeforce
s——1016
TableofContents
codeforce
s----1016
codeforce
s----1016A
codeforce
s----1016B
codeforce
s----1016C
codeforce
s-
lose__way
·
2020-09-14 19:32
codeforces
gym102460 F Miss Sloane 2019ICPC Taipei
https://
codeforce
s.com/gym/102460学习自出题人交的标程首先题目里面那个式子可以观察到发现是i*sum{e[i]},也就是你选了几个是这些e[i]之和乘以选的个数然后初始gcd
二分抄代码
·
2020-09-14 19:52
状态压缩
Vasya and Robot
http://
codeforce
s.com/contest/355/problem/C//FileName:cf_c.cpp//Author:bo_jwolf//CreatedTime:2013年10月
bo-jwolf
·
2020-09-14 19:52
Codeforces
codeforce
s1016D Vasya And The Matrix
C题写40多分钟,D题想不出,又靠rols上分,菜哭.jpg。rols的做法十分好理解,我们按二进制位数来考虑,看a数组中有多少个包含1cb[0],那么久给ans[ca[j]][1]安排上,cb数组还有剩余,就给ans[1][cb[j]]安排上。奇偶性不一样的时候,说明第一行或者第一列的1无法抵消变成相同的,那么就满足不了。此题另外一种,cf官方题解直接给第一排第一列安排,其他全是0,然后比较一下
二分抄代码
·
2020-09-14 19:52
思维
规律
gym102460 Rush Hour Puzzle 2019ICPC Taipei
https://
codeforce
s.com/gym/102460目标就是让1的右端点移动到(3,6)的位置,从(3,6)出去还要两步,那么最多就是移动8步,又因为最多只有10个物品,而且我们可以用hash
二分抄代码
·
2020-09-14 19:51
bfs
哈希表
codeforce
s1407D Discrete Centrifugal Jumps
https://
codeforce
s.com/contest/1407/problem/DmdA题没做出来,吧D过了以后一看cfpredictor竟然还能上分,刷牙的时候想着不会fst哪题吧?
二分抄代码
·
2020-09-14 19:51
gym102460I The Spectrum 2019ICPC Taipei
https://
codeforce
s.com/gym/102460曾今OI时期还是搜索king,打了acm以后没有搜索骗分了,弱智搜索题都不会写了dfs(k,l,r)表示每次取出一个剩下还没确定最大的差值
二分抄代码
·
2020-09-14 19:51
dfs
codeforce
s1407C Chocolate Bunny
https://
codeforce
s.com/contest/1407/problem/C因为是1-n的排列,那么如果pi%pjusingnamespacestd;typedeflonglongll;constintmaxl
二分抄代码
·
2020-09-14 19:51
交互
Codeforce
s,Kefa and Dishes,状态压缩DP
题意:给定n个物品,每个物品都有一个满意度v,现在从n个物品中选取m个,选的过程中有几个规则,它们是基于选择顺序给出的规则,例如:选择的过程中a和b相邻,且a在b的前面,则满意度增加c,现在给出了k个这样的规则。问你根据这些规则,从n个物品中选取m个的最大满意度是多少。范围:0#include#include#include#include#include#include#includeusing
lishuandao
·
2020-09-14 19:15
Codeforces
codeforce
985C
传送门C.Liebig'sBarrelstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouhavem = n·kwoodenstaves.Thei-thstavehaslengthai.Youhavetoassemblenbarrelsconsistingof
_Destiny_
·
2020-09-14 19:37
Codeforce
s Round #263 (Div. 2) D 树形dp
链接:戳这里D.ApplemanandTreetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputApplemanhasatreewithnvertices.Someofthevertices(atleastone)arecoloredblackandotherver
CrossDolphin
·
2020-09-14 19:05
树形dp
DFS
CodeForce
s - 545E Paths and Trees(Dijkstra单源最短路+边权值和最小)
LittlegirlSusieaccidentallyfoundherelderbrother'snotebook.Shehasmanythingstodo,moreimportantthansolvingproblems,butshefoundthisproblemtoointeresting,soshewantedtoknowitssolutionanddecidedtoaskyouabout
lgz0921
·
2020-09-14 19:32
Dijkstra
codeforce
s 580D Kefa and Dishes【状态压缩+dp】
题目大意:n个菜中选m个菜吃,每个菜有一个满意度ai,此外有k种情况:先吃xi再吃yi会额外增加ci满意度。问最大满意度。思路:数组dp[1#include#include#includeusingnamespacestd;typedef__int64LL;constintMAXN=20;LLsat[MAXN];LLmap[MAXN][MAXN];LLdp[1>n>>m>>k;for(inti=0
lhfl911
·
2020-09-14 19:32
dp
Codeforce
s Round #600 (Div. 2) 解题报告
相关链接比赛链接:Dashboard官方题解:EditorialA.SinglePushttt组数据。每组数据给定两个长为nnn的数组AAA和BBB,可以选择AAA的一个子序列A[l,r]A[l,r]A[l,r],将其中的每个数增加x(x>0)x(x>0)x(x>0),该操作至多进行一次。判断AAA能否转化成BBB。t≤20,n≤100000t\leq20,n\leq100000t≤20,n≤10
箜瑟_qi
·
2020-09-14 19:49
Codeforces
2道不错的cf题诶
题目链接:http://
codeforce
s.com/problemset/problem/567/CC.GeometricProgressiontimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputPolycarplovesgeometricprogressionsve
jxust_tj
·
2020-09-14 19:10
拓展思维题
CodeForces
codeforces
好题
思维题
CodeForce
s 274B Zero Tree
Atreeisagraphwithnverticesandexactlyn - 1edges;thisgraphshouldmeetthefollowingcondition:thereexistsexactlyoneshortest(bynumberofedges)pathbetweenanypairofitsvertices.AsubtreeofatreeTisatreewithbothver
_Occult_
·
2020-09-14 19:37
Codeforces
----树形dp
2200专项:F2. Same Sum Blocks (Hard)(k个子数组不相交且区间和相同)
原题:http://
codeforce
s.com/contest/1141/problem/F2题意:给出n长数组,有k个子数组不相交且区间和相同,求k的最大值。
JK Chen
·
2020-09-14 19:05
其他算法
CodeForce
s 366D Dima and Trap Graph
D.DimaandTrapGraphtimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputDimaandInnalovespendingtimetogether.Theproblemis,Seryozhaisn'ttooenthusiastictoleavehisroo
iteye_6551
·
2020-09-14 19:48
Codeforce
s 900C Remove Extra One
C.RemoveExtraOnetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenapermutationpoflengthn.Removeoneelementfrompermutationtomakethenumberofrecordsthe
TooSIMple_
·
2020-09-14 19:05
CodeForces
CF Educational
Codeforce
s Round 50 (Rated for Div. 2) D. Vasya and Arrays ʕ •ᴥ•ʔ
D.VasyaandArraystimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputVasyahastwoarraysAandBoflengthsnandm,respectively.Hecanperformthefollowingoperationarbitraryn
henucm
·
2020-09-14 19:15
CF
codeforce
s 215E 数位DP
链接:http://www.
codeforce
s.com/problemset/problem/215/E题意:问你lr之间有多少的数是周期数,周期数的定义为:这个数的二进制形式是以k为周期的,k#include
haha593572013
·
2020-09-14 19:06
Dynamic
Programming
Codeforces
Codeforce
s Round #198 (Div. 1)
E:给你n个数,每次可以拿出两个数,ab假设a0的序列。组合数学里面一开始就讲了一段话,先从小的case着手,然后归纳出问题的一般特性.这个题的话我们先考虑三个数的情况,如果三个数能够成功的将一个数变成0,那么n个数自然就可以了。事实上我们肯定可以将三个>0的数abc转换成ABC,满足a
haha593572013
·
2020-09-14 19:06
Contests
Codeforces
【
codeforce
s 274B】【树形DP】 B. Zero Tree【一棵树,每个点有权值,每次操作可以对一个联通子集中的点全部加或者减1,且每次操作必须包含点1,问最少多少次操作权值全为0】
传送门:B.ZeroTree描述:B.ZeroTreetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAtreeisagraphwithnverticesandexactlyn - 1edges;thisgraphshouldmeetthefollowingcon
QiufengWang424
·
2020-09-14 19:32
online
judge
Codeforces
------树形DP
codeforce
s215E(数位DP,规律水过)
地址:http://
codeforce
s.com/contest/215/problem/EE.PeriodicalNumberstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAnon-emptystringsiscalledbinary
ten_three
·
2020-09-14 18:55
数位DP
递推
codeforce
s 803C Maximal GCD
题意:给你n,k(#include#includeusingnamespacestd;longlongn,k;boolcheck(longlongx){if(x>n*2/k/(k+1))returnfalse;for(inti=1;i>n>>k;for(inti=1;(longlong)i*i=1;i--){if(n%i)continue;if(check(i))return0;}printf("
Difstpoftf
·
2020-09-14 18:05
ACM
Dima and Sequence
CodeForce
s - 272B (思维题)
Dimagotintonumbersequences.Nowhe’sgotsequencea1, a2, …, an,consistingofnpositiveintegers.Also,Dimahasgotafunctionf(x),whichcanbedefinedwiththefollowingrecurrence:f(0) = 0;f(2·x) = f(x);f(2·x + 1) = f(
elbadaernu
·
2020-09-14 18:32
思维题
CodeForce
s - 597 C. Subsequences(dp+线段树or树状数组优化)
Forthegivensequencewithndifferentelementsfindthenumberofincreasingsubsequenceswithk + 1elements.Itisguaranteedthattheanswerisnotgreaterthan8·1018.InputFirstlinecontaintwointegervaluesnandk(1 ≤ n ≤ 10^
elbadaernu
·
2020-09-14 18:32
dp
线段树&树状数组&主席树
[
codeforce
s1118F1]Tree Cutting (Easy Version)
timelimitpertest:2secondsmemorylimitpertest:256megabytesYouaregivenanundirectedtreeofnnnvertices.Someverticesarecoloredblue,somearecoloredredandsomeareuncolored.Itisguaranteedthatthetreecontainsatleas
dxyinme
·
2020-09-14 18:31
图的遍历
[
codeforce
s][gym101343J]Husam and the Broken Present 2
timelimitpertest:1.0smemorylimitpertest:256MBAfteryouhelpedHusamandrebuilthisbeautifularrayahebecameveryhappy.Toavoidlosinghisarrayagain,Husammadencopiesfromit,anddistributedittonofhisfriends.Aftertha
dxyinme
·
2020-09-14 18:31
状态压缩动态规划
Kefa and Dishes(
CodeForce
s580D)[状态压缩DP]
状态压缩DP裸题,比赛的时候没反应过来,进行了n次枚举起点的solve,导致超时。#include#include#include#includeusingnamespacestd;intn,m,k;intcost[20][20],val[20];inta,b,c;longlongdp[1hhh[19];intjudge(intx){intres=0;while(x!=0){if(x&1)res+
dmqocbae156792
·
2020-09-14 18:25
codeforce
s 540E Infinite Inversions(离散化+树状数组)
题目:一个无限数列,1,2,3,4,...,....,给n个数对把数列的i,j两个位置的元素交换。求交换后数列的逆序对数。思路:离散点并且把两点之间的m个数当作一个数来看记下贡献,然后就是普通的树状数组求逆序对,需要用longlong!#includeusingnamespacestd;typedeflonglongll;constintmaxn=2e5+10;intl[maxn],r[maxn]
GoLakerswxy
·
2020-09-14 18:25
树状数组
CodeForce
s 274B 树形dp
//继续水一道树形dp1#include"iostream"2#include"cstdio"3#include"cstring"4#include"algorithm"5#include"cmath"6usingnamespacestd;7__int64dp[100010][2];8boolvis[100010];9inttot,first[100010<<1],next[100010<<1],
diufeng0879
·
2020-09-14 18:54
codeforce
s 580D:Kefa and Dishes
DescriptionWhenKefacametotherestaurantandsatatatable,thewaiterimmediatelybroughthimthemenu.Therewerendishes.Kefaknowsthatheneedsexactlymdishes.Butatthat,hedoesn'twanttoorderthesamedishtwicetotasteasma
dgoh41514
·
2020-09-14 18:48
Educational
Codeforce
s Round 45--D. Graph And Its Complement
题目链接:http://
codeforce
s.com/contest/990/problem/D题意:给你n,a,b,让你输出一个n*n的无向图,其图的连通块为a,其补图的连通块为b。
dhydye
·
2020-09-14 18:48
图论
Codeforce
s 1106F(数论)
要点998244353的原根g=3,意味着对于任意\[1#include#include#include#includeusingnamespacestd;typedeflonglongll;constintp=998244353,g=3;intK,b[101],n,fn,hn,hk;structMatrix{intn;intv[101][101];Matrix(intn){memset(v,0,
dengliaotu5386
·
2020-09-14 18:44
Codeforce
s274B
Codeforce
s274B做法:树形dp,\(up[u]\)至少加多少次,\(down[u]\)至少减多少次可以消去u这棵子树转移:首先\(up[u]=max(up[v]),down[u]=max(down
dehukun0483
·
2020-09-14 18:43
Codeforce
s 911F 贪心
分析:先求出树的直径,以这个直径上的节点作为主干。假设两个端点分别为x,y,求其他任意叶子节点z到另一个叶子节点的最长距离即为max{d(x,z),d(y,z)}该解法的正确性我无法给出证明,但画图看看应该就不难理解的。代码如下:#include#include#includeusingnamespacestd;typedeflonglongLL;constintmaxn=2e5+10;struc
老年退役选手
·
2020-09-14 18:58
ACM入门
贪心
Codeforce
s Round #260 (Div. 1)B题(字典树+DFS+博弈)
B.ALotofGamestimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAndrew,FedorandAlexareinventiveguys.Nowtheyinventthegamewithstringsfortwoplayers.Givenagroupofnn
cq_phqg
·
2020-09-14 18:27
数据结构_字典树
Codeforce
s Round #272 (Div. 1)D(字符串DP)
D.DreamoonandBinarytimelimitpertest2secondsmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputDreamoonsawalargeintegerxwrittenonthegroundandwantstoprintitsbinaryformout.Dreamoonhasacc
cq_phqg
·
2020-09-14 18:27
区间DP
The Meaningless Game
CodeForce
s - 834C (思维题)
TheMeaninglessGame
CodeForce
s-834CSlastyonaandherloyaldogPushokareplayingameaninglessgamethatisindeedveryinteresting.Thegameconsistsofmultiplerounds.Itsrulesareverysimple
Guuuuuu老师儿
·
2020-09-14 18:26
#
思维技巧
Codeforce
s Round #499 (Div. 2) DEF 题解
和轩少一起Virtualparticipation了这次比赛,A题读错题花了大量时间导致只有4题就滚粗了。D.Rocket题意:让你猜一个位置x,范围在1-m,每次你询问系统y,如果xy回答1,但是系统有可能会说假话,你只知道系统真假性的回答是周期n(nusingnamespacestd;inta[50];intmain(){intn,m,k,p=-1;cin>>n>>k;for(inti=0;i
一只叫橘子的猫
·
2020-09-14 18:37
codeforces
比赛题解
【
CodeForce
s500E】New Year Domino (线段树+并查集+栈)
题目大意有一排多米诺骨牌,按x坐标顺序从左到右输入,每个骨牌有他的位置p,高度l,可以花费1代价使骨牌高度+1,有q个询问,询问一个区间l,r,从l开始推倒,使[l,r]区间全部倒下的最小代价。题解考虑将询问排序,离线处理。因为左边的骨牌有可能会推倒它右边的连续一段区间的骨牌,我们处理询问时应按询问左端点从右往左处理。设当前左端点已经处理到第ll个骨牌。用addadd数组存储每个骨牌需要增加的量。
CaptainHarryChen
·
2020-09-14 18:05
题解
CodeForce
s 827D Round #423 Div2F&Div1D:LCA+路径压缩+MST(最小生成树)
题意:给出一张n(usingnamespacestd;#defineMAXN200005constintINF=0x3f3f3f3f;structEdge{intstart,des,length,id;//booloperatordes);//}booloperatorE[MAXN];vectorremainE;intfather[MAXN];intfa[MAXN][20];intmaxLengt
calabash_boy
·
2020-09-14 18:33
Codeforces
CodeForce
s 501B——Misha and Changing Handles
题意:给定一些姓名的原来姓名和修改后的名字,由于一个名字可以被修改多次,所以求所有用户的初始姓名和当前姓名。思路:暴力。数据量很小,对于每次修改直接判断其是否有原来的名字即可,有的话更新,没有就作为新用户push进去。code:#include#include#include#include#include#include#include#include#include#include#inclu
WildKid1024
·
2020-09-14 18:27
Codeforces
Codeforce
s 449C 贪心
JzzhuandApplestimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputJzzhuhaspickednapplesfromhisbigappletree.Alltheapplesarenumberedfrom1ton.Nowhewantstosellthemto
black_miracle
·
2020-09-14 18:55
每日一题
贪心
codeforce
s C. Bits(数学题+或运算)
题意:给定一个区间,求区间中的一个数,这个数表示成二进制的时候,数字1的个数最多!如果有多个这样的数字,输出最小的那个!思路:对左区间的这个数lx的二进制从右往左将0变成1,直到lx的值大于右区间的值rx!1#include2#include3#include4#include56usingnamespacestd;78intmain(){9longlonga,b;10intn;11cin>>n;
aipiannian6725
·
2020-09-14 18:33
9.5——模拟赛
「
Codeforce
sRound#418」尘封思绪题目描述理由さえも忘れてた淚で哭泣的理由早已遗忘,泪水却依旧不止凍りついた想い出は綺麗で回忆早已冻结,但仍然美丽给定两个整数序列aaa和bbb,其中bbb
agcozdwdfvds08078
·
2020-09-14 18:32
Codeforce
s 1016F Road Projects
RoadProjects根据基环分类讨论讨论。。#include#defineLLlonglong#defineLDlongdouble#defineullunsignedlonglong#definefifirst#definesesecond#definemkmake_pair#definePLLpair#definePLIpair#definePIIpair#defineSZ(x)((int
afd5154
·
2020-09-14 18:01
上一页
57
58
59
60
61
62
63
64
下一页
按字母分类:
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
其他