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 Gym 101190 NEERC 16 I. Indiana Jones and the Uniform Cave
真是神题其实递归的写是不难写的我在昏昏欲睡的时候参考了别人的代码写了手工栈非递归的意识模糊#include#include#include#include#include#includeusingnamespacestd;stringret;inttot;inlinevoidP(intx,inty,intz){++tot;printf("%d%s%d\n",x,!y?"left":"right",
里阿奴摩西
·
2020-08-15 08:49
杂题
交互题&提交答案题
[杂题]
Codeforce
s Gym 101190 NEERC 16 K. Kids Designing Kids
其实就是三个图异或起来为空要的就是个观察aftermovingthefigures,sometwoofthesethreefrecklesmustbeinthesamepoint.Thereareonlythreepossibleshifts,checkthemall#include#include#include#include#defineXfirst#defineYsecondusingna
里阿奴摩西
·
2020-08-15 08:18
杂题
B - Two Cakes
CodeForce
s - 911B
It’sNewYear’sEvesoon,soIvandecidedit’shightimehestartedsettingthetable.Ivanhasboughttwocakesandcutthemintopieces:thefirstcakehasbeencutintoapieces,andthesecondone—intobpieces.Ivanknowsthattherewillben
tomjobs
·
2020-08-15 08:10
#
codeforces
codeforces水题
Educational
Codeforce
s Round 28 B: Math Show
MathShowPolycarptakespartinamathshow.Heisgivenntasks,eachconsistsofksubtasks,numbered1throughk.Ittakeshimtjminutestosolvethej-thsubtaskofanytask.Thus,timerequiredtosolveasubtaskdependsonlyonitsindex,b
ZJLORD
·
2020-08-15 07:09
codeforse
codeforce
s 846B Math Show
B.MathShowtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputPolycarptakespartinamathshow.Heisgivenntasks,eachconsistsofksubtasks,numbered1throughk.Ittakeshimtj
至此曾经
·
2020-08-15 07:47
codeforce
######
其他
######
NEERC 2016年B题 Binary code
题目链接(里面B题):https://
codeforce
s.com/gym/
code_lxm
·
2020-08-15 06:23
解题报告
Codeforce
s Gym 101190 NEERC 2016 B. Binary Code
题解#includeusingnamespacestd;#defineN500010#defineM4000000vectorc[N];vectora[N<<1],g[M];intnum,nx[N<<1][2],w[N<<1],w2[N<<1];inti,j,k,n,m,p,pos[N],pr[N<<1],sf[N<<1],l;intRt=1;chars[N];inlinevoidInsert(i
gjghfd
·
2020-08-15 06:03
2-SAT
字典树
B. Two Cakes
Codeforce
sRound#542[AlexLopashevThanks-Round](Div.2)题意:两个人都从最左边出发,对于每个人来说都要拿够从1-n的每个数,相邻两个数距离是1,问最小花费步数可以让两个人全部拿够
Mercury_Lc
·
2020-08-15 05:28
思维题
/
Codeforces
Codeforce
s Gym 101190 (NEERC 2016) F. Foreign Postcards (dp + 期望)
题意对于一叠n张卡片,随机取前k张若取到的k张的第一张为W,则k张卡片的状态全部翻转。将k张卡片在桌面上展示若一叠卡片仍有剩余,则继续上述操作问最后桌面上为W的卡片的期望?解题思路首先计算对于第i张卡片,其为k张中的第一张的概率,依次为1,1n,1n−1,…(比较好处理,不作说明)。令dp[i][0]表示第i张卡片不翻的概率,dp[i][1]表示第i张卡片翻转的概率,则dp[i][0]+dp[i]
ffutop
·
2020-08-15 05:11
Codeforces
Gym
dp
期望
Codeforce
s Gym 101190 (NEERC 2016) A. Abbreviation
题意定义capitalizedword为首字母大写,后接一个或更多小写字母的单词定义abbreviatablesequenceofwords为两个或两个以上capitalizedword的首字母合并序列对于给定的若干行字符串,将满足条件的capitalizedword表示为它的缩写,并在其后括号中打印原单词。解题思路将每行字符串拆分成单词和分隔符。找出其中的capitalizedword并标记。结
ffutop
·
2020-08-15 05:11
Codeforces
Gym
[Trie树优化建图 2-SAT]
Codeforce
s Gym101190B. Binary Code
把所有串建成一棵Trie树,相当于任意一条从根到叶子的链上都至多有一个点,用类似于前缀优化建图的方法建图#include#include#include#include#includeusingnamespacestd;constintN=5000010;intn,lst,cnt,tot,cc,len[N],imark[N],pos[N],G[N],fa[N],nxt[N][2];chara[N]
LowestJN
·
2020-08-15 05:06
字典树
2-SAT
Codeforce
s Round #490 (Div. 3) A. Mishka and Contest
A.MishkaandContesttimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputMishkastartedparticipatinginaprogrammingcontest.Therearennproblemsinthecontest.Mishka'sprob
Cantredo
·
2020-08-15 05:05
刷题及经验总结
[Trie树建图 2-SAT]
Codeforce
s Gym 101190 NEERC 16 B. Binary Code
把所有串都扔进字典树如果有两个是祖先和子孙的关系就不能共存那么我们直接用字典树辅助建一下图跑2-SAT就好了ps.同时一个点上只能有一个还要用前后缀建一下图说起来真轻松#include#include#include#include#includeusingnamespacestd;inlinecharnc(){staticcharbuf[100000],*p1=buf,*p2=buf;retur
里阿奴摩西
·
2020-08-15 05:25
字典树
2-SAT
Present 【
CodeForce
s - 460C】【线段树+二分答案】
题目链接这道题问的就是有N朵花,可以浇水M天,每天可以浇连续区间长度为W的水,问花的最小值的最大情况是多少?不妨去二分答案这样的最小值,然后为了节约时间,可以利用线段树来更新,时间复杂度就下降到了O(N*log(INT_MAX)*logN)可以行。具体代码是这样的:#include#include#include#include#include#include#include#include#in
Andres_Lionel
·
2020-08-15 03:04
线段树
数据结构
Codeforce
s Round #553 (Div. 2) C. Problem for Nazar
题目链接:https://codeforc.es/contest/1151/problem/C题意:有两个无限的奇数集合和偶数集合构造一个新的数组,先是放前2^0个奇数,然后集合中移除这些数,在放2^1个偶数进去新的数组,重复操作思路:看见2的幂就知道可以直接来logn模拟了,自己做的时候考虑的时候是用前缀和记录每一份奇数和偶数有多少个,并且记录下每一份的长度和首项,后面用等差数列来求和即可中间的
canwinfor
·
2020-08-15 01:00
Educational
Codeforce
s Round 93 (Rated for Div. 2) 题解
Educational
Codeforce
sRound93(RatedforDiv.2)题解A.BadTriangle排序之后只用看第一个第二个和最后一个元素是否满足条件即可#includeusingnamespacestd
0xDkXy_DWM
·
2020-08-15 01:00
Educational
Codeforce
s Round 93 (Rated for Div. 2)
传送门A.BadTriangle题意:给出一个不降的序列\(a\),要求判断是否能在其中找出三个下标递增且不能组成三角形的数,能则输出三个下标,否则输出\(-1\)。题解:贪心思考怎样最容易凑不出三角形,选择前两个和最后一个即可,此时若凑出了三角形就输出\(-1\)。Code#include<bits/stdc++.h>#definepbpush_back#definempmake_pair#
LKP1111
·
2020-08-15 01:00
Educational
Codeforce
s Round 93 Div2 A~E题解
闲话本场出了ABCD,因为思路不正确卡了很久D.非常的无语.A.BadTriangle题目大意:给定\(n\)个元素的不降序列,找出三个不同位置的元素使他们三个不能组成一个三角形.思路直接拿最小的两个和最大的一个拼就可以了.代码#includeusingnamespacestd;typedeflonglongll;constintN=3e5+7;lla[N];intmain(){intT;scan
随处可见的阿宅
·
2020-08-15 00:00
Educational
Codeforce
s Round 93 (Rated for Div. 2)
A题意:给你一串递增数列,找出不能构成三角形的三个数,否则输出$-1$。分析:签到题,一开始没看到是递增的,还用$pair$排了个序(活该)。直接判断最小的两个和最大的关系,如果这个可以那么全部都可以。1#include2usingnamespacestd;3typedeflonglongll;4constllmaxn=1e5+100;5constllmod=1e9+7;6constllinf=0
Zabreture
·
2020-08-15 00:00
CodeForce
s 368B. Sereja and Suffixes
思路:这道题是对于一串数字,每给定一个位置,就指出从这个位置往右一直到最后一个元素之间有多少不重复的数字。涉及到数字重复问题,想到用map处理。再用动态规划,从后往前依次加一或者不变既可。#include#include#include#includeusingnamespacestd;inta[100005];intdp[100005];mapmp;intmain(){intn,m;//intc
RioTian
·
2020-08-14 22:00
codeforce
s contest 1117 C. Magic Ship---二分
题目链接:https://
codeforce
s.com/problemset/problem/1117/C题解:二分天数可解该题,主要是要考虑的曼哈顿距离的性质,风带来的影响是不能改变的,所以可以预处理出风带来的距离改变
·O_0·
·
2020-08-14 21:26
思维
C. Magic Ship
http://
codeforce
s.com/contest/1117/problem/C题意:给定起终点,n个风向(循环),顺风则移动2步,成角度则到角度的一步,逆风不动;问是否能到达终点;思路:相当于先随风移动再自由移动
newhonor
·
2020-08-14 21:51
二分
[codefoeces] Educational
Codeforce
s Round 60 C. Magic Ship
timelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouacaptainofaship.Initiallyyouarestandinginapoint(?1,?1)(x1,y1)(obviously,allpositionsintheseacanbedescribe
weixin_30662539
·
2020-08-14 20:36
C. Magic Ship (思维+二分)
https://
codeforce
s.com/contest/1117/problem/C你是一个船长。
weixin_30493321
·
2020-08-14 20:54
【
Codeforce
s1117C_CF1117C】Magic Ship(构造)
题目:
Codeforce
s1117C考的时候很困,开局半小时后才过A,只做出来AB,排名3000+,掉了119……半夜体验极差。翻译:你是一个船长。
weixin_30474613
·
2020-08-14 20:51
Codeforce
s Global Round 1 E. Magic Stones(思维,差值)
题解:思维题,对于头尾数字一定,让A数组变成B数组,要想到差值那块,如果差值一样,那么因为首尾一样,所以数组也一样。然后看自己能否能发现那个规律了,对于a[i],我们发现对a[i]操作后变成a[i+1]+a[i-1]-a[i],操作前的相邻差值是a[i]-a[i-1],a[i+1]-a[i],操作后,相邻差值变成a[i+1]-a[i],a[i]-a[i-1],所以操作i等价于对i的左右差值交换。那
路过一座山
·
2020-08-14 20:48
cf Educational
Codeforce
s Round 60 C. Magic Ship
原题:C.MagicShiptimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouacaptainofaship.Initiallyyouarestandinginapoint(x1,y1)(obviously,allpositionsintheseacanbed
红鲤鱼遇绿鲤鱼
·
2020-08-14 19:26
二分/三分
根本不会/就差一点/记得再看
cf
二分
codeforce
s309A的解题报告
codeforce
s的A题一般是比较简单的,题目的地址是http://
codeforce
s.com/problemset/problem/390/A题目的大意是:Inna是个贪睡虫,要有很多闹钟才能叫醒她
sola_aptx4869
·
2020-08-14 19:53
python
Codeforce
s Round #577 (Div. 2)(部分题解)
A.ImportantExam题意:n个学生m个题,每个学生都会给出m个答案,每个答案正确会得到num[i]的分,不正确不得分。现在并不知道正确答案是什么。假设学生的答案是正确的,班上所有学生总分最多能拿到多少?思路:二维矩阵的应用haha把每一道题答案相同最多的记录下来乘以该题正确答案的分数就行了。代码:#include#definelllonglongusingnamespacestd;cha
短发--短发
·
2020-08-14 19:46
CF
Codeforce
s Round #575 (Div. 3)(部分题解)
A.ThreePilesofCandies俩人平分三堆糖果,输出平分后的数量代码:#include#definelllonglongusingnamespacestd;intmain(){lla,b,c;intq;scanf("%d",&q);while(q--){llans=0;scanf("%lld%lld%lld",&a,&b,&c);ans=a+b+c;printf("%lld\n",an
短发--短发
·
2020-08-14 19:46
CF
Codeforce
s Round #588 (Div. 2)(部分题解)
A.题意:给你四个数,问你能不能通过相加使得它们分成两个相等的值题解:从小到大排序,前三个相加是否等于第四个或第一加第四是否等于第二加第三。代码:#includeusingnamespacestd;intmain(){inta[8];for(inti=0;iusingnamespacestd;intmain(){intn,k,num=1;stringstr;scanf("%d%d",&n,&k);
短发--短发
·
2020-08-14 19:16
CF - Magic Gems (DP+矩阵快速幂优化)
CF-MagicGems题目链接:Educational
Codeforce
sRound60(RatedforDiv.2)MagicGems题意有两种宝石,第一种是普通宝石,第二种是魔法宝石,每个魔法宝石可以分成
H_M_D
·
2020-08-14 19:09
DP
万物
想法
纷飞
CF - Nastya Is Buying Lunch (DP/想法)
题目链接:
Codeforce
sRound#546(Div.2)D.NastyaIsBuyingLunch题意给出一个长度为n的置换,再给出m组(ui,vi)(u_i,v_i)(ui,vi)代表如果ui在
H_M_D
·
2020-08-14 19:09
DP
万物
CodeForce
Multidimensional Queries (多维曼哈顿距离)
CodeForce
MultidimensionalQueries题目链接:http://
codeforce
s.com/contest/1093/problem/G题意在一个K维空间中给出N个点,M个询问
H_M_D
·
2020-08-14 19:08
线段树
树状数组
莫队
想法
纷飞
【 Educational
Codeforce
s Round 60 (Rated for Div. 2) C. Magic Ship】二分
C.MagicShip题意有一艘船,每个单位时间可以选择向U,D,L,R四个方向移动一个单位长度或者在原地不动并且船会被风向具有周期性的风往当前风的方向吹一个单位长度,现在给你船的起始位置和目标位置求船最少需要多少单位时间能到达目的地。做法答案满足二分性,因为如果我们已经到达,就可以一直与风反向行驶,保持船不动,所以具有二分性。我们只需要二分答案,并且O(n)进行check船是否可以到达即可。代码
lajiyuan_
·
2020-08-14 19:19
Codeforces
二分
【CF1117】【二分】Magic Ship
Educational
Codeforce
sRound60(RatedforDiv.2)题目链接【小结】:掉分了,同时也说明自己还需要锻炼锻炼,过年期间就没有打过比赛,原因还是太懒了。
Z_sea
·
2020-08-14 16:21
CF
二分
Codeforce
s Round #662 (Div. 2) A-D --白话题解
#include#include#include#include#include#include#include#include#include#defineF(i,a,b)for(inti=a;i=a;i--)#definelllonglong#definedbdoubleusingnamespacestd;constllpm=1e9+7;constllinf=2147482647;A给一个n要
Cake_C
·
2020-08-14 15:42
ACMP
算法
数据结构
动态规划
Educational
Codeforce
s Round 92 (Rated for Div. 2) ABC--白话题解
#include#include#include#include#include#include#defineF(i,a,b)for(inti=a;i=a;i--)#definelllonglong#definedbdoubleusingnamespacestd;A:给L,R要求两个数ans1、ans2,使得L>T;while(T--){llL,R;llans1,ans2;cin>>L>>R;if
Cake_C
·
2020-08-14 15:42
ACMP
Codeforce
s Round #664 (Div. 2) A-D --白话题解
A:4种颜色的球,红绿蓝白各r,g,b,w个,可以进行若干次操作,每次将一个r、g、b同时转化为白色即r–,g–,b–,w+=3问能否使得最后的四种颜色能排列成回文串能构成回文的情况是四种不同字母中,至多只有一种字母数量为奇数而每一次操作同时改变四种颜色的奇偶性,所有只要判断能否用少于一次操作使之至多只有一种字母数量为奇数intmain(){intT;cin>>T;while(T--){llr,g
Cake_C
·
2020-08-14 15:11
ACMP
算法
数据结构
字符串
CF - Magic Ship (二分)
CF-MagicShip(二分)题目链接:Educational
Codeforce
sRound60(RatedforDiv.2)MagicShip题意给你一个起始点(sx,sy),要求到达(ex,ey)
H_M_D
·
2020-08-14 15:27
二分
搜索
codeforce
s F. Machine Learning
题目:http://
codeforce
s.com/contest/940/problem/F题意:给一个长度为n的序列和q次操作。
让我改变你的心智
·
2020-08-14 14:37
莫队算法
Machine Learning
CodeForce
s - 940F (带修改的莫队)
Youcomehomeandfellsomeunpleasantsmell.Whereisitcomingfrom?Youaregivenanarraya.Youhavetoanswerthefollowingqueries:Youaregiventwointegerslandr.Letcibethenumberofoccurrencesofiinal: r,whereal: risthesuba
weixin_30547797
·
2020-08-14 14:04
CodeForce
s 981D Bookshelves
题目:点击打开链接题意:给你n本书以及每本书的权值,现在让你把n本书放到k个书架上(只有连续的几本书可以放到一个书架上),每个书架的权值是书架上每本书的权值加和,总的"beauty"是每个书架权值按位与的结果,要求输出最大的"beauty"。分析:因为要求总"beauty"是所有书架权值的按位与的结果,所以对于总"beauty"的二进制,位数越高的1的价值越大,所以可以从高位开始枚举这一位是否能取
Self-Discipline
·
2020-08-14 14:15
ACM
codefoces
【
codeforce
s 981E. Addition on Segments】【线段树】【bitset 01背包的妙用优化】【好题】【操作集区间的最大值能否构成】
【链接】http://
codeforce
s.com/contest/981/problem/E【题意】给定q个区间加的操作,求出这q个操作的所有子集的所有最大值,在[1,n]的范围内【分析】要知道一个数能否可由某个操作集得到
lzk_1049668876
·
2020-08-14 14:16
线段树
bitset
01背包
codeforce
s 981 D. Bookshelves(DP+贪心)
题目链接:http://
codeforce
s.com/contest/981/problem/D思路:从高位到低位枚举答案位数,然后dp验证哪一位能不能取到,emmm感觉自己dp是真的垃圾,思路很快想到
llmxby
·
2020-08-14 14:19
dp
贪心
codeforce
s 981 E. Addition on Segments(线段树+bitset)
题目链接:http://
codeforce
s.com/contest/981/problem/E思路:因为是查询的子集,所以其实只要看这些子集能凑出那些数字就好了,每次查询是l,r,x相当于l-r每个点加
llmxby
·
2020-08-14 14:48
线段树
Codeforce
s981E
题目链接:http://
codeforce
s.com/contest/981/problem/E题意:给出若干个操作,问任意选出这些操作的子集,最大值的在1-n的有多少种可能。
做不完的ACM
·
2020-08-14 14:33
很套路的题
DP
背包
Bitset优化
动态规划
线段树
【带修莫队】
CodeForce
s 940F Machine Learning
Source:Source:Source:
Codeforce
sRound#466(Div.2)Problem:Problem:Problem:nnn个整数,mmm种操作,一种是查询[l,r][l,r][
Toooooocold
·
2020-08-14 13:51
数据结构-莫队算法
codeforce
s981e(线段树+bitset)
E.AdditiononSegmentstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputGrishacometoacontestandfacedthefollowingproblem.Youaregivenanarrayofsizenn,initiallycons
yyPurpose_forever
·
2020-08-14 13:15
数据结构
STL标准库容器
Codeforce
s 940 F - Machine Learning(带修改莫队, 及注意事项)
F-MachineLearningYoucomehomeandfellsomeunpleasantsmell.Whereisitcomingfrom?Youaregivenanarraya.Youhavetoanswerthefollowingqueries:Youaregiventwointegerslandr.Letcibethenumberofoccurrencesofiinal: r,wh
Error Man
·
2020-08-14 13:52
#
codeforces
#
分块
莫队
上一页
130
131
132
133
134
135
136
137
下一页
按字母分类:
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
其他