摘要:
``` #include using namespace std; #define ll long long void print_permutation(int n,int* A,int cur){ if(cur==n){ for(int i=0;i>n){ print_permutation(n,a,0); } return 0; } ``` 阅读全文
摘要:
传送门 [http://codeforces.com/group/1EzrFFyOc0/contest/1016/problem/D] 题意 已知矩阵n行m列,以及每一行,每一列所有元素的异或,用 a1到an表示行异或值,用b1到bm表示列异或值 让你构造一个矩阵满足上面的要求 思路 整个矩阵所有元 阅读全文
摘要:
链接 [http://codeforces.com/contest/1017/problem/B] 题意 给你两个长度为n,包含0和1的字符串a和b,有一种操作swap a中的任意两个字符使得a&b的值改变 思路 首先任意位置对位情况有图片中这4种,这题关键是如何去重,我们知道b串的是0才有可能交换 阅读全文
摘要:
链接 [http://codeforces.com/contest/1013/problem/B] 题意 给你一个n和x,再给n个数,有一种操作用x&a[i]取代,a[i],问使其中至少两个数相同,要多少次操作,如果不能输出 1. 思路 x&a[i],无论&多少次,a[i]都只有一次改变,所以可以知 阅读全文
摘要:
传送门 [http://codeforces.com/contest/1013/problem/C] 题意 输入一个n代表n颗星星,输入2n个数,其中任意两个数代表一颗行星的坐标,问你把n个星星围起来的最小矩形面积。 思路 先对2n 个数小到大排序,因为矩形是要求把这n个点框住的,所以稍微想一下不难 阅读全文
摘要:
链接 [http://codeforces.com/group/1EzrFFyOc0/contest/706/problem/B] 题意 给你n个数,q次查询,每次输入一个m,问n个数中有多少个数小于等于m 思路 先排序,再用upper_bound找,该函数返回第一个大于m的下标。 代码: 阅读全文
摘要:
理解来源 [https://baike.baidu.com/item/%E6%A0%91%E7%8A%B6%E6%95%B0%E7%BB%84/313739?fr=aladdin] include using namespace std; const int maxn=500005; int tre 阅读全文
摘要:
链接[http://codeforces.com/group/1EzrFFyOc0/contest/706/problem/C] 题意: 他希望它们按词典顺序排序(就像字典中那样),但他不允许交换其中的任何一个。 唯一允许他做的操作是将其中的任何一个反转(第一个字符变成最后一个, 第二个字符变成最后 阅读全文