来自FallDream的博客,未经允许,请勿转载,谢谢. Div1难度+ACM赛制  和几个大佬组队逛了逛 A.给一个大小为n的集合ai(1<=ai<=1000000),要求你构造一个大小同样为n且值域相同的数组b,满足ai+bj没有相同的. T<=100 n<=100 暴力,从小到大枚举过去,可以选就选. 复杂度T(n^3+10^6) B.给你n个字符串,要求你选一些前缀构成一个前缀集合,满足不存在两个前缀,其中一个去掉首字母之后变成另一个.求集合最大大小. n<=10^6…
2017 Russian Code Cup (RCC 17), Final Round A Set Theory 思路:原题转换一下就是找一个b数组,使得b数组任意两个数的差值都和a数组任意两个数的差值相等 根据题目数据范围, 肯定可以构造一个1, 1+d, 1+2d, 1+3d, ... , 1+(n-1)*d的序列 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) #include<bits…
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…
D - Acute Triangles 思路: 极角排序+点积叉积 在一个三角形中,如果它是直角或者顿角三角形,那么直角和顿角只会出现一次 所以直角和顿角三角形的个数等于直角和顿角的个数 所以锐角三角形的个数等于三元组个数减去直角和顿角的个数 三点共线看成退化的顿角三角形 怎么算直角和顿角个数呢, 先按某个点极角排序,然后暴力过取,用双指针维护到 当前幅角距离为pi/2 到 3*pi/2 的区间, 区间内点的个数就是到当前幅角为直角或顿角的个数 可以用点积和叉积分别判断角度和相对方向 代码: #…
题目链接: 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…
D. Restructuring Company Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/566/problem/D Description Even the most successful company can go through a crisis period when you have to make a hard decision — to restructure, disca…