【Codeforces Round #430 (Div. 2) D】Vitya and Strange Lesson
【链接】点击打开链接
【题意】
【题解】
【错的次数】
【反思】
【代码】
/**/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <cstdlib>
#include <cmath>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb emplace_back
#define fi first
#define se second
#define ld long double
#define ms(x,y) memset(x,y,sizeof x)
#define ri(x) scanf("%d",&x)
#define rl(x) scanf("%lld",&x)
#define rs(x) scanf("%s",x)
#define rf(x) scnaf("%lf",&x)
#define oi(x) printf("%d",x)
#define ol(x) printf("%lld",x)
#define oc putchar(' ')
#define os(x) printf(x)
#define all(x) x.begin(),x.end()
#define Open() freopen("F:\\rush.txt","r",stdin)
#define Close() ios::sync_with_stdio(0)
#define sz(x) ((int) x.size())
#define ld long doubletypedef pair<int, int> pii;
typedef pair<LL, LL> pll;//mt19937 myrand(time(0));
//int get_rand(int n){return myrand()%n + 1;}
const int dx[9] = { 0,1,-1,0,0,-1,-1,1,1 };
const int dy[9] = { 0,0,0,-1,1,-1,1,-1,1 };
const double pi = acos(-1.0);
const int N = 19;struct node {node *ch[2];int val;node() { ch[0] = ch[1] = NULL; val = 0; }
} *root;int n, m, a[N + 10];
bool bo[1 << N];void insert(int x) {node *p = root;rep2(i, (N-1), 0) {int temp = (x >> i) & 1;if (p->ch[temp] == NULL) p->ch[temp] = new node();p = p->ch[temp];}p->val = x;
}int query(int x) {node *p = root;rep2(i, (N-1), 0) {int temp = (x >> i) & 1;if (p->ch[temp] == NULL)p = p->ch[temp ^ 1];elsep = p->ch[temp];}return p->val;
}int main() {//Open();//Close();root = new node();ri(n), ri(m);rep1(i, 1, n) {int x;ri(x);bo[x] = 1;}rep1(i, 0, (1 << N)-1) if (!bo[i])insert(i);int now = 0;rep1(i, 1, m) {int x;ri(x);now ^= x;oi(now^query(now)); puts("");}return 0;
}
转载于:https://www.cnblogs.com/AWCXV/p/7626069.html
【Codeforces Round #430 (Div. 2) D】Vitya and Strange Lesson相关推荐
- 【Codeforces Round #430 (Div. 2) B】Gleb And Pizza
[链接]点击打开链接 [题意] 在这里写题意 [题解] 根据圆心到原点的距离这个东西判断一下圆在不在那个环里面就好 [错的次数] 0 [反思] 在这了写反思 [代码] #include <cst ...
- 【Codeforces Round #424 (Div. 2) C】Jury Marks
[Link]:http://codeforces.com/contest/831/problem/C [Description] 有一个人参加一个比赛; 他一开始有一个初始分数x; 有k个评委要依次对 ...
- 【Codeforces Round #422 (Div. 2) C】Hacker, pack your bags!(二分写法)
[题目链接]:http://codeforces.com/contest/822/problem/C [题意] 有n个旅行计划, 每个旅行计划以开始日期li,结束日期ri,以及花费金钱costi描述; ...
- 【Codeforces Round #420 (Div. 2) B】Okabe and Banana Trees
[题目链接]:http://codeforces.com/contest/821/problem/B [题意] 当(x,y)这个坐标中,x和y都为整数的时候; 这个坐标上会有x+y根香蕉; 然后给你一 ...
- 【Codeforces Round #299 (Div. 2) B】Tavas and SaDDas
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 每次取出最小的数字,在后面加上一个4或一个7就好; 会发现最后的数字很少的. [代码] #include <bits/stdc ...
- 【Codeforces Round #446 (Div. 2) C】Pride
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 想一下,感觉最后的结果肯定是从某一段开始,这一段的gcd为1,然后向左和向右扩散的. 则枚举那一段在哪个地方. 我们设这一段中所有的 ...
- 【Codeforces Round #452 (Div. 2) C】 Dividing the numbers
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] n为偶数. l = 1, r = n (l,r)放在一组 l++,r-- 新的l,r放在另外一组 直到l+1==r 这个时候,判断两 ...
- 【Codeforces Round #442 (Div. 2) A】Alex and broken contest
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 注意是所有的名字里面,只出现了其中某一个名字一次. [代码] #include <bits/stdc++.h> usin ...
- 【Codeforces Round #450 (Div. 2) B】Position in Fraction
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 找循环节就好. ->其实可以不用找出来整个循环节. 有找到c就直接输出. 找到了循环节还没找到的话,直接输出无解. [代码] ...
最新文章
- 剑指offer:面试题11. 旋转数组的最小数字
- StackOverFlow上你没看过的7个Java最佳答案
- php值传递和java_Java的值传递和引用传递
- VTK:vtkChartMatrix用法实战
- 【洛谷 1969】积木大赛
- 搜索文献_【大牛经验分享】如何高效快捷搜索文献?
- 老年人学摄影,装备该如何选择?
- ext3日志模式---文件系统
- Azure Linux VM密钥登录
- php增加md5加密的方法_php进行md5加密简单实例方法
- 【CFD学习】yplus,y+,边界层理论,壁面第一层网格
- .mat转.tif 用于arcgis裁剪遥感图像
- java dead store_jcip Java并发编程实战源码,这本书名为《 践》有些抹杀了它的价值,其中 Develop 238万源代码下载- www.pudn.com...
- 明日之后系统互通的服务器,明日之后安卓苹果互通么?安卓苹果混服/能联机吗问题介绍[图]...
- Error response from daemon: removal of container XXXXXis already in progress解决方法
- [内存管理]内存池pool库
- 一定会在计算机领域取得成功英文,西子的英文考卷
- python中正切函数_Python tan() 函数
- 大学C语言期末考试题库试题及答案(1)
- e.preventDefault