2017CCPC 网络选拔赛1003 Ramsey定理】的更多相关文章

Ramsey定理 任意6个人中,一定有三个人互为朋友,或者互相不是朋友. 证明 这里我就不证明了.下面链接有证明 鸽巢原理 Ramsey定理 AC代码 #include <stdio.h> #include <algorithm> using namespace std; const int maxn = 3000+5; bool r[maxn][maxn]; int main() { int T, n; scanf("%d", &T); while(T…
题目链接 Problem Description It is well known that small groups are not conducive of the development of a team. Therefore, there shouldn't be any small groups in a good team. In a team with n members,if there are three or more members are not friends wit…
解题思路: fail树上用权值线段树合并求right/endpos集合,再用倍增找到待查询串对应节点,然后权值线段树求第k大. #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=1e5+5; int n,q; char s[maxn]; namespace SegTree{ int sum[maxn*100],L[maxn*100],R[maxn*100]; int tot1; i…
题意:给你一个长度为n的字符串,有q个询问,每次询问一个子串s(l,r)第k次出现的位置,若子串出现次数少于k次输出-1. 解题思路:先把SA跑出来,然后对于每次询问可以由l和rank[]找到l在所有后缀中的排名,再用两次二分求出使得LCP(L,R)包含s(l,r)的最大区间[L,R],LCP可以借助height[]的性质和ST表求得,即[L,R]包含rank[l]且min{height[L+1],height[L+2],...,height[R]}>=r-l+1.现在问题就转化为了求[L,R]…
题目链接 裸的结论题.百度 Ramsey定理.刚学过之后以为在哪也不会用到23333333333,没想到今天网络赛居然出了.顺利在题面更改前A掉~~~(我觉得要不是我开机慢+编译慢+中间暂时死机,我还能再早几分钟过掉它 #include<bits/stdc++.h> using namespace std; ][]; int n; void solve() { ; i<=n; i++) ; j<=n; j++) ; k<=n; k++) { if(g[i][j]==g[i][…
$$2019中国大学生程序设计竞赛(CCPC)\ -\ 网络选拔赛$$ \(A.\hat{} \& \hat{}\) 签到,只把AB都有的位给异或掉 //#pragma comment(linker, "/STACK:1024000000,1024000000") #include<bits/stdc++.h> using namespace std; function<void(void)> ____ = [](){ios_base::sync_wit…
Magic boy Bi Luo with his excited tree Problem Description Bi Luo is a magic boy, he also has a migic tree, the tree has N nodes , in each node , there is a treasure, it's value is V[i], and for each edge, there is a cost C[i], which means every time…
Robots Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 60    Accepted Submission(s): 13 Problem Description QXJ has N robots on the plane, the i-th is at (xi,yi), numbereded 1 to N. Every robot…
Count The Pairs Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 277    Accepted Submission(s): 150 Problem Description   With the 60th anniversary celebration of Nanjing University of Science…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6447 Problem DescriptionYJJ is a salesman who has traveled through western country. YJJ is always on journey. Either is he at the destination, or on the way to destination.One day, he is going to travel…