记录详情

Accepted


  
# 状态 耗时 内存占用
#1 Accepted 3ms 264.0 KiB
#2 Accepted 3ms 256.0 KiB
#3 Accepted 16ms 384.0 KiB
#4 Accepted 26ms 384.0 KiB
#5 Accepted 614ms 384.0 KiB
#6 Accepted 649ms 384.0 KiB
#7 Accepted 614ms 308.0 KiB
#8 Accepted 633ms 380.0 KiB
#9 Accepted 623ms 344.0 KiB
#10 Accepted 630ms 384.0 KiB

代码

#include <bits/stdc++.h>
using namespace std;
inline int read(){
	int x=0;char ch=getchar();
	while(ch>'9'||ch<'0')ch=getchar();
	while(ch<='9'&&ch>='0')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x;
}
int bin[40], a[40], n, k, ans;
int main(){
	int n = read(), k = read();
	for(int i = 1; i <= 30; i++) bin[i] = 1<<i;
	for(int i = 1, x; i <= n; i++){
		x = read(); ans ^= x;
		for(int i = 0; i <= 30; i++)
			if(x&bin[i]) a[i] ^= x;
	}
	if(k == 1) return printf("%d\n", ans)&0;
	int p = 30; while(!(ans&bin[p]))p--;
	printf("%d %d\n", min(ans^a[p], a[p]), max(ans^a[p], a[p]));
}

信息

递交者
类型
递交
题目
亚由题
语言
C++
递交时间
2017-05-02 13:21:35
评测时间
2017-05-02 18:08:23
评测机
分数
100
总耗时
3816ms
峰值内存
384.0 KiB