Problem H. Horrible Truth Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100610 Description In a Famous TV Show “Find Out” there are n characters and only one Horrible Truth. To make the series breathtaking all way long, the sc…
链接:https://www.nowcoder.com/acm/contest/104/B来源:牛客网 题意:A few days ago, WRD was playing a small game called Salty Fish Go. We can simplify the rules of the game as follows. 给你v,l,n,m代表有v个速度,下一行分别给出v个速度,l长的路,n个随机地点随机改变速度的加油站,m个随机地点宝藏.问拿到所有宝藏的时间期望. 题解:瞎…
B. Cards 题目连接: http://www.codeforces.com/contest/626/problem/B Description Catherine has a deck of n cards, each of which is either red, green, or blue. As long as there are at least two cards left, she can do one of two actions: take any two (not ne…
瞎搞题啊.找出1 1 0 0这样的序列,然后存起来,这样的情况下最好的选择是1的个数除以这段的总和. 然后从前向后扫一遍.变扫边进行合并.每次合并.合并的是他的前驱.这样到最后从t-1找出的那条链就是最后满足条件的数的大小. Room and Moor Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 307 Accepted…
首先注意 先hash一下,双hash,然后枚举删去位置,把hash值排个序,把些相等的加起来统计一下对数即可 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=30005; int ans,n,m,k; long long h1[N][205],h2[N][205],a[N]; char s[205]; int main() { scanf(&…
脑补一下给出的图:一个环,然后有若干连接环点的边,我们就是要求这些边不重叠 考虑一下不重叠的情况,两个有交边一定要一个在环内一个在环外,所以把相交的边连边,然后跑黑白染色看是否能不矛盾即可(可能算个2-SAT?) #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int N=100005; int T,n,m,q[N],a[205][205],cnt,h[N]…
本来想爆手速写个树剖,然而快下课了就手残写了了个n方的短小-- 暴力把查询的两个点中深的一个跳上来,加上边权,然后一起跳加边权就行了 #include<iostream> #include<cstdio> using namespace std; const int N=1005; int n,q,h[N],cnt,fa[N],va[N],de[N]; struct qwe { int ne,to,va; }e[N<<1]; int read() { int r=0,f…
某种意义上真毒瘤?我没看懂题啊...于是看了题解 就是筛约数的那种方法,复杂度调和级数保证O(nlogn) 所以这题啥意思啊 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=1000005; int n,mx,a[N],c[N],d[N]; int read() { int r=0,f=1; char p=getchar(); while(p…