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 280C Game on Tree 概率
题目链接:http://
codeforce
s.com/problemset/problem/280/C推荐阅读博客:http://blog.csdn.net/qq574857122/article/details
latstars
·
2020-08-23 01:58
------数学------
Codeforce
s632F Magic Matrix
传送门题目大意给定一个n×n的矩阵,若满足以下条件则称其为MagicMatrix:ai,i=0.ai,j=aj,i.∀i,j,k,s.t.ai,j≤max(ai,k,aj,k).判断给出的矩阵是否为Magic.1≤n≤2500,0≤ai,j#include#include#include#include#include#include#include#include#include#include
kyleyoung_ymj
·
2020-08-23 01:47
题目解读
Codeforces
数据结构
---bitset
Codeforce
s 1181 D Irrigation 题解(树状数组+倍增)
题目:CF1181D.题目大意:有一个长度为mmm的计数数组aaa,初始均为000,并给定nnn个操作xxx表示让a[x]a[x]a[x]加111.现在还有一些操作,一个操作是在a[i]a[i]a[i]中找一个最小的位置ppp(有多个则去最小的满足条件的ppp),使得a[p]a[p]a[p]加111.现在有qqq个询问,问第kkk个操作(前nnn个操作也算入)时的ppp.1≤n,m,q≤5∗105
hezlik
·
2020-08-23 01:11
Codeforce
s Round #561 (Div. 2) ABCDE
传送门A.SilentClassroom水题。#includeusingnamespacestd;#definelllonglongmapmp;intmain(){intn;cin>>n;for(inti=1;i>s;mp[s[0]]++;}llans=0;for(chari='a';i1){if(mp[i]%2){//coutusingnamespacestd;#definelllonglong
henucm
·
2020-08-23 01:56
CF
期望的线性性(可加性)【
CodeForce
s280c】【bzoj3036】【bzoj2134】
...好像题有点古老了bzoj那道都不见了都没法去交了只好贴别人的代码了大佬博客
Codeforce
s280c题意给出一棵含n个白点的有根树,每次随机选择一个还没有被染黑的节点,将这个节点和这个节点子树中的所有点染黑
henucm
·
2020-08-23 01:56
期望的线性性
Codeforce
s Round #389 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 3) 总结
这场真是GG,比赛的时候就写出了三道题,还都比较水(可怜的standing才2000QωQ)。A.SantaClausandaPlaceinaClass题意:有一个n*m的区域,每个位置有一个桌子,桌子有两个座位,座位上都有数字,如图排列(一个桌子左右为相邻数字,桌子间竖向排列)。给出一个数字k,问对应的座位在第r列的第d个,以及在某桌的左面还是右面(’L’/‘R’)。解法:直接计算。先不论左/右
heheyh123
·
2020-08-23 01:53
AC自动机 fail树 线段树维护
http://
codeforce
s.com/problemset/problem/163/Ehttp://acm.hdu.edu.cn/showproblem.php?
haha593572013
·
2020-08-23 01:16
Data
Structures
Dynamic
Programming
Strings
codeforce
s1355 C. Count Triangles
codeforce
s1355C.CountTrianglestimelimitpertest:1secondmemorylimitpertest:256megabytesinput:standardinputoutput
five_east_west
·
2020-08-23 01:53
ACM
Codeforce
s 11D A Simple Task 统计简单无向图中环的个数
题目表述Givenasimplegraph,outputthenumberofsimplecyclesinit.Asimplecycleisacyclewithnorepeatedverticesoredges.InputThefirstlineofinputcontainstwointegersnandm(1 ≤ n ≤ 19,0 ≤ m)–respectivelythenumberofvert
餃子
·
2020-08-23 01:19
codeforces
算法
dp
graph
codeforce
s如何快速上分
我在网上看到了很多类似的问题以及许多答案,但觉得都不实用,因为像开两个号每次打rating低的什么的来涨分(比如涨到2000+之类的)一定是基于你水平可以在div2基本稳定在打进至少全球前1000,偶尔能全球前一两百名甚至几十名。也就是说,如果你水平不是太高的话,任何花里胡哨的方法可能能让你涨一点分,但绝对不能让你快速涨分。而我,根据这篇博客下面会介绍的涨分方法,今年(2020年)5月31号左右才
chenshige
·
2020-08-23 01:05
Codeforce
s 950D A Leapfrog in the Array
Dimaisabeginnerprogrammer.Duringhisworkingprocess,heregularlyhastorepeatthefollowingoperationagainandagain:toremoveeverysecondelementfromthearray.Onedayhehasbeenboredwitheasysolutionsofthisproblem,and
bao___zi
·
2020-08-23 01:42
Codeforces
找规律
思考题
Codeforce
s 917F Substrings in a String - 后缀自动机 - 分块 - bitset - KMP
题目传送门传送点I传送点II传送点III题目大意给定一个字母串,要求支持以下操作:修改一个位置的字母查询一段区间中,字符串$s$作为子串出现的次数Solution1Bitset每次匹配一段,可以看成,依次考虑每个位置,匹配的位置对应的起点取交集。例如:大概就这个意思。bitset的count似乎很慢,可以用__builtin_popcount来数中间的位数,然后暴力数两端的位数会快很多。感觉手写倍
adx33526
·
2020-08-23 01:18
Codeforce
s 1181D Irrigation
Irrigation把询问离线,从小到大解决,转换成求第k大的问题,套个平衡树就好啦。#include#include#defineLLlonglong#defineLDlongdouble#defineullunsignedlonglong#definefifirst#definesesecond#definemkmake_pair#definePLLpair#definePLIpair#def
afd5154
·
2020-08-23 01:47
CF1399B Gifts Fixing
原题链接:http://
codeforce
s.com/problemset/problem/1399/BGiftsFixingYouhavengiftsandyouwanttogiveallofthemtochildren.Ofcourse
ShadyPi
·
2020-08-23 00:59
杂============
贪心
CF1399A Remove Smallest
原题链接:http://
codeforce
s.com/problemset/problem/1399/ARemoveSmallestYouaregiventhearrayaconsistingofnpositive
ShadyPi
·
2020-08-23 00:59
杂============
贪心
CodeForce
s 280C Game on Tree题解理解
题目链接C.GameonTreetimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputMomijihasgotarootedtree,consistingofnnodes.Thetreenodesarenumberedbyintegersfrom1ton.Therooth
MashiroRin
·
2020-08-23 00:37
codeforce
s 632F. Magic Matrix (最小生成树)
You'regivenamatrixAofsizen × n.Let'scallthematrixwithnonnegativeelementsmagicifitissymmetric(soaij = aji),aii = 0andaij ≤ max(aik, ajk)foralltriplesi, j, k.Notethati, j, kdonotneedtobedistinct.Determi
Herumw
·
2020-08-23 00:26
树形dp
bitset
codeforce
s1196F K-th Path 全源k短路
网址:http://
codeforce
s.com/contest/1196/problem/F题意:求一个无向无环无重边的连通图的全源$k$短路。
FairyTail0423
·
2020-08-23 00:37
数据结构与算法
(Educational
Codeforce
s Round 9)Magic Matrix(最小生成树)★
题意:给定一个n*n的矩阵,要求你判断是否满足以下条件:(1)a[i][i]=0。(2)a[i][j]==a[j][i]&&i!=j。(3)对于任意a[i][j]=a[i][j]。O(n^2logn)#include#include#include#include#include#include#include#include#include#include#include#include#inc
Ezereal
·
2020-08-23 00:05
思维
图论—MST
【
CodeForce
s-280C】Game on Tree(期望可加性)
outputstandardoutputMomijihasgotarootedtree,consistingofnnodes.Thetreenodesarenumberedbyintegersfrom1ton.Theroothasnumber1.Momijidecidedtoplayagameonthistree.Thegameconsistsofseveralsteps.Oneachstep,M
coldfresh
·
2020-08-23 00:26
概率与期望
Codeforce
s Round 508(DIv.2) (A, B, C, D)
A模拟题解:用cnt[i][j]表示第字母i(0-25)在字符串(0-j)的出现次数。然后枚举一下cnt[i][n-1]的最小值即可。#include#include#include#includeusingnamespacestd;constintmaxn=100005;intcnt[26][maxn];chars[maxn];intn,k;boolcheck(intx,intlen){for(
elorole
·
2020-08-23 00:59
Codeforces
Manthan, Codefest 18 (rated, Div. 1 + Div. 2)(A,B,C, D)
比赛链接:http://
codeforce
s.com/contest/1037A:题意:把n用尽可能少的划分,使得1-n的所有数都能表示出来(选的时候要么选一次,要么不选)比如6=1+2+3,这样就可以表示出
elorole
·
2020-08-23 00:58
Codeforces
Codeforce
s #495 div.2(A, B, C)
A.模拟#includeusingnamespacestd;intn,d,ans;inta[105];intmain(){cin>>n>>d;for(inti=1;i>a[i];ans+=2;for(inti=2;i2*d)ans+=2;}cout#includeusingnamespacestd;intmain(){intn,m,l,r;scanf("%d%d",&n,&m);for(inti=
elorole
·
2020-08-23 00:28
Codeforces
Codeforce
s——949B. A Leapfrog in the Array.
949B看到这个数据范围,我的第一想法是找找规律,看看最后的排列和n有没有什么关系。果不其然,有规律:奇数位置loc的值就是(loc+1)/2。偶数呢??如果忽略奇数位置的值,只看偶数位置的排列。如果n为奇数(1、3除外):例如:n=5,只看偶数位置的排列:54n=7,只看偶数位置的排列:657n=9,只看偶数位置的排列:9687n=11,只看偶数位置的排列:9711810所以,从最小的位置开始,
C画中仙
·
2020-08-23 00:38
Codeforce
s——914F Substrings in a String
大致题意:给一个字符串str,再给n次操作,其中1操作是改变str中pos位置的字符,2操作是查询[l,r]中字符串s出现的次数。第一次用bitset,感觉真是个好东西。真好用。洛谷上面有人写了题解,但是没有写的很具体,所以从来没写过bitset的我就只能一直猜他代码的意思,花了一点时间才搞懂了bitset,其实就是先暴力统计每种字符的位置,然后再用一个temp(bitset类型)去统计每次要查询
C画中仙
·
2020-08-23 00:38
字符串
Codeforce
s Round #640 (Div. 4)
A.题意:给出一个数n把n拆成若干个除首位以外都是0的和思路:%一下/一下就行#includeusingnamespacestd;#defineLLlonglong#defineULLunsignedlonglong#definemes(x,a)memset(x,a,sizeof(x));#definesca(a)scanf("%d",&a)#definelowbit(x)x&(-x)#defin
傻子不会玩
·
2020-08-22 23:56
比赛
Codeforce
s Round #636 (Div. 3)
A.题意:计算是否存在x+2x+4x+…+=n思路:暴力计算根据等比数列公式x=n/(2^n-1)暴力枚举分母是否存在即可#includeusingnamespacestd;intmain(){intt;cin>>t;while(t--){longlongn;cin>>n;for(inti=2;iusingnamespacestd;#defineLLlonglong#defineULLunsign
傻子不会玩
·
2020-08-22 23:56
比赛
Codeforce
s Round #623D. Recommendations并查集
D.Recommendationstimelimitpertest2secondsmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputVKnewsrecommendationsystemdailyselectsinterestingpublicationsofoneofndisjointcategoriesfore
傻子不会玩
·
2020-08-22 23:56
补题
数据结构
Educational
Codeforce
s Round 84 (Rated for Div. 2)
A.SumofOddIntegerstimelimitpertest:2secondsmemorylimitpertest:256megabytesinput:standardinputoutput:standardoutputYouaregiventwointegersnnandkk.Yourtaskistofindifnncanberepresentedasasumofkkdistinctpo
傻子不会玩
·
2020-08-22 23:56
比赛
Codeforce
s Round #661 (Div. 3) Binary String To Subsequences 队列
题意:给你一个01串要求把他分成不同的子序列并且子序列中不能有两个相同的数相邻输出分成最少子序列的个数并且输出每个0或者1分别在哪个子序列思路:一开始看到这个题,就想到用栈或者队列来模拟这个过程,vector来存答案,但是栈无法得到最初未配对0或者1出现的位置,所以采用队列,我们开两个队列,一个用来存0的位置,一个用来存1的位置。1.当遇到0时,首先肯定先找有没1和他配对,如果队列1为空的话,说明
傻子不会玩
·
2020-08-22 23:56
补题
数据结构
codeforce
s E. Famil Door and Roads 期望
一棵树,n个节点,边长为1,有q个询问,每个询问给出u,v(u!=v),问在树上等概率加一条边,如果使得u,v在一个环内,则这种加边方式是合法的,此时的值为环的长度,所有合法的加边方式出现的概率相等,问值的期望。2#defineLLlonglongusingnamespacestd;constintMAXN=100000+2;intsiz[MAXN],dis[MAXN];intpa[MAXN][2
weixin_30287169
·
2020-08-22 23:50
「第一弹」
Codeforce
s杂题
「第一弹」
Codeforce
s杂题CF559D题意给出一个nnn个点的凸包,等概率选则该凸包点集的大于等于三的子集形成一个新凸包,问该凸包内部整点的期望值。
绍兴土匪
·
2020-08-22 22:52
总结
D. Alice, Bob and Candies
Alice,BobandCandies题目链接:https://
codeforce
s.com/contest/1352/problem/D题意:Alice是从左边开始吃,而Bob从右边开始吃,两个人轮流吃
遇见生活
·
2020-08-22 14:45
CF题解
Codeforce
s Round #483 (Div. 1) A B C
A-Finiteornot?在除完$gcd$之后,只需要看$q$的质因子是不是全部都被$b$包含就行,但是注意每次要把$b=gcd$,不然TLE#includeusingnamespacestd;typedeflonglongLL;typedefunsignedlonglongULL;LLGcd(LLa,LLb){if(b==0)returna;returnGcd(b,a%b);}LLLcm(LL
TongChu
·
2020-08-22 12:09
算法
动态规划
数学
质数
gcd
【字符串】科学计数法转换
原题链接http://
codeforce
s.com/problemset/problem/697/B把例如3.93472e8的科学技术法转换为393472000的整数输出方法一、直接用input.nextBigDecimal
Maple丶峰
·
2020-08-22 10:07
Codeforce
s Round #240 (Div. 1) ABCD
转载请注明出处题目链接A:把分数尽量放在第一对数对上,然后让剩下的数对两两互质即可,注意一些特殊情况(m=0或者n=1)B:dp[长度][当前最后一个数的大小],这样去转移:dp[len][x]=sigma(dp[len-1][y,y是x的因数]),因为每个数的约数都不多。C:建立归并树,求一下每一层新产生顺序对和逆序对然后注意到,进行操作x时,只会影响归并树中第[x,n]层的逆序关系,那么就把对
Nero___
·
2020-08-22 04:17
ACM_Contest
Codeforce
s 831D Office Keys————DP/二分
题解:本题主要考查DP/二分。简要题意:给你nnn个人,有kkk把钥匙,终点为mmm.每个人要求拿一把钥匙到终点,问多长时间,能够使得所有人都到达。把所有人的位置以及钥匙的位置全部sort一遍,1.二分:排序后,前一个去的钥匙位置一定在后一个人取得钥匙前面,否则交叉浪费时间。然后二分最长时间,从左向右验证。2.DP:设dp[i][k]dp[i][k]dp[i][k]表示前iii个人,前jjj把钥匙
wly127
·
2020-08-22 04:16
DP
CodeForce
s - 1111C(Creative Snap)
题意:有2^n个基地,k个复仇者,每个复仇者占据一个位置(可以叠加),为了摧毁整个基地,从区间[1,2^n]开始,对于每一个区间[l,r]有两种选择:①:二分操作[l,mid]和[mid+1,r];②:若当前区间内没有复仇者,则花费代价A摧毁这个区间的基地,若有cnt个复仇者,则花费代价B*(r-l+1)*cnt摧毁这个区间的复仇者和基地。求摧毁整个基地的最小代价。分析:n上限是30,就区间大小上
半缘、
·
2020-08-22 04:58
CodeForce
s - 1111C——分治
CodeForce
s-1111C题解:直接分治,对应的区域求有多少个复仇者,如果没有直接返回,不然会超时。
行走天涯的豆沙包
·
2020-08-22 04:43
二分
Codeforce
s Round #488 by NEAR (Div. 2)(01分数规划)
E.CarefulManeuveringtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputTherearetwosmallspaceship,surroundedbytwogroupsofenemylargerspaceships.Thespaceisatwo-di
Gakiu_u
·
2020-08-22 04:14
算法竞赛
01分数规划
Codeforce
s 1169
1169B题意给你一个paira[]数组(\(a[i].first≠a[i].second\)),现在问你是否存在\(x,y\),使得对于每个\(a[i]\),\(a[i].first,a[i].second\)中至少有一个数等于\(x\)或等于\(y\)。(样例中第一个数是\(a\)中的最大值,第二个数是\(a\)的长度)Examplesinput46121314232434outputNOin
weixin_30586085
·
2020-08-22 03:08
NOIWC2019游记
/23Wednesday明天该走了,早上买了两桶泡面,是有点小兴奋,之前没坐过飞机虽然说我想坐火车去,火车上可以透彻啊要是按照姓氏分宿舍就要被rqy大佬虐了晚上Virtualparticipation
Codeforce
sRound
weixin_30500105
·
2020-08-22 03:32
Lucky Days -
codeforce
题意题解线段\([l_a+kt_a,r_a+kt_a]\),\([l_b+kt_b,r_b+kt_b]\)相交,可以建立一个不等式:\[l_b\leqy\leqr_b\]\[y\equivl_a+kt_a(mod(t_b))\]转化一下:\[y=l_a+kt_a+ht_b\]\(k,h\)都是变量,那么由欧几里得扩展可知:\(k,h\)存在时,\(gcd(t_a,t_b)|(y-l_a)\)。至此
weixin_30413739
·
2020-08-22 03:58
codeforce
s 100959B Airports 曼哈顿距离最大生成树
写了两种做法。1.对于每个点,向八个象限建最长边,注意最长边没有最短边的对称性,故每个点不能只枚举4个方向,要8个方向都枚举。这个做法速度较快,用的树状数组:#includeusingnamespacestd;typedefpairpii;constintmaxn=100005;constintinf=2e9+1;intn,pos[maxn],f[maxn],bit[maxn],res,x,y;s
QQ小炫
·
2020-08-22 03:34
acm
CF 366E - Dima and Magic Guitar 最远曼哈顿距离
题目:http://
codeforce
s.com/problemset/problem/366/E其实就是找n*m矩阵中数字x和数字y的最远距离。
Z-Pilgrim
·
2020-08-22 03:13
数学--杂
Codeforce
s Contest 1055 problem C Lucky Days —— 区间相交最大长度
BobandAliceareoftenparticipatinginvariousprogrammingcompetitions.Likemanycompetitiveprogrammers,AliceandBobhavegoodandbaddays.Theynoticed,thattheirluckyandunluckydaysarerepeatingwithsomeperiod.Forexam
天翼之城*
·
2020-08-22 03:47
想法
数学
III USP Freshmen Contest C. MaratonIME eats japanese food
来源:http://
codeforce
s.com/gym/101375/problem/C题解:A就把盘子放到桌面上,R就把盘子从桌面上拿走,A输出No的可能性有3种:1.盘子之前放过了,vis数组标记
suheyin
·
2020-08-22 03:59
acm题目练习
二分-
Codeforce
s-1169C Increasing by Modulo
题目链接题意:n个数,每进行一次操作可以任选其中几个数使其变为+1后对m取余的数求将这个数列变为非递减序列(后面的数总是大于等于前面的数)的最小操作次数思路:这道题想到二分就很简单了。。。(时间复杂度log2(n))剩下的过程见注释#include#includeusingnamespacestd;inta[300005];intmain(){intn,m,i;scanf("%d%d",&n,&m
早晨OvO
·
2020-08-22 02:28
Codeforces
二分
Codforces1169C.Increasing by Modulo 二分
https://
codeforce
s.com/contest/1169/problem/C#includeusingnamespacestd;typedeflonglongll;typedefpairpii
阿晴0219
·
2020-08-22 02:37
二分
CodeForce
s - 1055F Tree and XOR (01字典树)
题目链接题意:给你一棵树,每个结点上有点权,让你找出树上每一条xorxorxor路径里面的值排第kkk小的值是多少。解题思路:每一条xorxorxor路径(u,v)(u,v)(u,v),我们可以看成是两条从根节点到u,vu,vu,v的路径异或起来。首先我们可以很快想到一个二分的做法,先在记录有多少条路径等于这个值,二分一个值,然后比较和kkk的关系。然而,这样的复杂度是O(nlognlogn)O(
purple_bro
·
2020-08-22 02:03
codeforces
上一页
97
98
99
100
101
102
103
104
下一页
按字母分类:
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
其他