B. Neural Network country time limit per test 2 seconds memory limit per test 256 megabytes Due to the recent popularity of the Deep learning new countries are starting to look like Neural Networks. That is, the countries are being built deep with ma…
Bubble Cup 12 - Finals Online Mirror, unrated, Div. 1 C. Jumping Transformers 我会状压 DP! 用 \(dp[x][y][mask]\) 记录到达 \((x,y)\),之前清楚的排骨龙集合为 \(mask\) 的最小耗费. 如果到达 \((x,y)\) 时,本应遭遇的排骨龙没了,那么想想:这只排骨龙是何时遭到放逐? 很自然地设计出状态:\(dp[x][y][len][0/1]\) 表示当前在 \(x\) 行, \(y\…
Bubble Cup 11 - Finals [Online Mirror, Div. 1] 一场很好玩的题啊! I. Palindrome Pairs 枚举哪种字符出现奇数次. G. AI robots 对\(r\)从大到小排序,然后cdq分治. 注意要对\(q-k,q+k,q\)进行离散化 B. Space Isaac 对原序列做差分,b[i]=a[i]-a[i-1] 如果我们要凑出\(x\),那么集合A中小于\(x\)的数字,要关于\(x/2\)对称,大于\(x\)的数字要关于\((x+m…
题目链接: http://codeforces.com/contest/575/problem/B 题解: 把链u,v拆成u,lca(u,v)和v,lca(u,v)(v,lca(u,v)是倒过来的).这样就只要考虑自下而上的线性结构了,可以用前缀和的思想来做成段更新. 代码: #include<cstdio> #include<vector> #include<cstring> #include<iostream> #include<algorithm…
H. Bots Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/575/problem/H Description Sasha and Ira are two best friends. But they aren’t just friends, they are software engineers and experts in artificial intelligence. They are…
D. Tablecity Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/575/problem/D Description There was a big bank robbery in Tablecity. In order to catch the thief, the President called none other than Albert – Tablecity’s Chief o…
F. Bulbo Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/575/problem/F Description Bananistan is a beautiful banana republic. Beautiful women in beautiful dresses. Beautiful statues of beautiful warlords. Beautiful stars in…
来自FallDream的博客,未经允许,请勿转载,谢谢. 组了个菜鸡队打cf上的ACM比赛 比较快做完了8题但是菜的抠脚罚时巨多,所以最后被顶到了19名(居然没出首页) 自己的号自从上次疯狂掉分就没动过了,感觉像是红名橙名大佬中的一股清流. A.奇怪的贪心,我写了一发结果挂了,题解见大爷博客 B.dp方程很容易列出来,然后写个矩阵乘法就行了. C.每个点的位置决定了两边的白色小三角形的面积,这个面积是关于位置的一次函数,所以排序之后贪心就行了. D.二分+网络流判定 E.dp方程容易列出,然后换…
题意略,题解生成函数练习题,1+(q-ai)x卷积即可,线段树优化(类似分治思想) //#pragma GCC optimize(2) //#pragma GCC optimize(3) //#pragma GCC optimize(4) //#pragma GCC optimize("unroll-loops") //#pragma comment(linker, "/stack:200000000") //#pragma GCC optimize("O…
题意:定义两个数\(a,b\)是朋友,如果:\(gcd(a,b)\),\(\frac{a}{gcd(a,b)}\),\(\frac{b}{gcd(a,b)}\)能构成三角形,现在给你一个正整数\(n\),问你\(1-n\)中有多少数没有朋友. 题解:首先考虑合数,设\(a=b*c\),\(b\ge c\),\(b\ge 2,c\ge 2\),我们知道:\(gcd(b,b-1)=1\),那么:\(gcd(b*c,(b-1)*c)=c\),则对于:\(b*c\),\((b-1)*c\),\(gcd(…