303994: CF768C. Jon Snow and his Favourite Number

Memory Limit:256 MB Time Limit:4 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Jon Snow and his Favourite Number

题意翻译

题意: 你有一串长度为n的序列a,重复k次操作,问操作后的序列的极值值. 操作: 将序列从小到大排序,从1标号,对序号为奇数的数^(xor)x. 输入格式: 第一行三个数n,k,x. 接线来一行n个整数,为序列元素. 输出格式: 一行两个数,第一个为最大值,第二个为最小值. 数据范围: n,k:[1,1e5] x,a[i]:[1,1e3] 注意: None. 感谢@尘染梦 提供的翻译

题目描述

Jon Snow now has to fight with White Walkers. He has $ n $ rangers, each of which has his own strength. Also Jon Snow has his favourite number $ x $ . Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now thinks that if he takes the bitwise XOR of strengths of some of rangers with his favourite number $ x $ , he might get soldiers of high strength. So, he decided to do the following operation $ k $ times: 1. Arrange all the rangers in a straight line in the order of increasing strengths. 2. Take the bitwise XOR (is written as ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF768C/4298d47c0191af3c0a3103f431751061bc7e2362.png)) of the strength of each alternate ranger with $ x $ and update it's strength. Suppose, Jon has $ 5 $ rangers with strengths $ [9,7,11,15,5] $ and he performs the operation $ 1 $ time with $ x=2 $ . He first arranges them in the order of their strengths, $ [5,7,9,11,15] $ . Then he does the following: 1. The strength of first ranger is updated to ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF768C/24f90c2cc72378ab6783dec726f8d9e331c9228a.png), i.e. $ 7 $ . 2. The strength of second ranger remains the same, i.e. $ 7 $ . 3. The strength of third ranger is updated to ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF768C/9098a8bdc05db39883c735270717a1ad5e1610bb.png), i.e. $ 11 $ . 4. The strength of fourth ranger remains the same, i.e. $ 11 $ . 5. The strength of fifth ranger is updated to ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF768C/2c9f1429ecc1107a1b6b4cc8616d78419b516a77.png), i.e. $ 13 $ . The new strengths of the $ 5 $ rangers are $ [7,7,11,11,13] $ Now, Jon wants to know the maximum and minimum strength of the rangers after performing the above operations $ k $ times. He wants your help for this task. Can you help him?

输入输出格式

输入格式


First line consists of three integers $ n $ , $ k $ , $ x $ ( $ 1<=n<=10^{5} $ , $ 0<=k<=10^{5} $ , $ 0<=x<=10^{3} $ ) — number of rangers Jon has, the number of times Jon will carry out the operation and Jon's favourite number respectively. Second line consists of $ n $ integers representing the strengths of the rangers $ a_{1},a_{2},...,a_{n} $ ( $ 0<=a_{i}<=10^{3} $ ).

输出格式


Output two integers, the maximum and the minimum strength of the rangers after performing the operation $ k $ times.

输入输出样例

输入样例 #1

5 1 2
9 7 11 15 5

输出样例 #1

13 7

输入样例 #2

2 100000 569
605 986

输出样例 #2

986 605

Input

题意翻译

题意: 你有一串长度为n的序列a,重复k次操作,问操作后的序列的极值值. 操作: 将序列从小到大排序,从1标号,对序号为奇数的数^(xor)x. 输入格式: 第一行三个数n,k,x. 接线来一行n个整数,为序列元素. 输出格式: 一行两个数,第一个为最大值,第二个为最小值. 数据范围: n,k:[1,1e5] x,a[i]:[1,1e3] 注意: None. 感谢@尘染梦 提供的翻译

加入题单

算法标签: