CF578B."Or" Game

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given nn numbers a1,a2,...,ana_{1},a_{2},...,a_{n} . You can perform at most kk operations. For each operation you can multiply one of the numbers by xx . We want to make as large as possible, where denotes the bitwise OR.

Find the maximum possible value of after performing at most kk operations optimally.

输入格式

The first line contains three integers nn , kk and xx ( 1<=n<=2000001<=n<=200000 , 1<=k<=101<=k<=10 , 2<=x<=82<=x<=8 ).

The second line contains nn integers a1,a2,...,ana_{1},a_{2},...,a_{n} ( 0<=ai<=1090<=a_{i}<=10^{9} ).

输出格式

Output the maximum value of a bitwise OR of sequence elements after performing operations.

输入输出样例

  • 输入#1

    3 1 2
    1 1 1
    

    输出#1

    3
    
  • 输入#2

    4 2 3
    1 2 4 8
    

    输出#2

    79
    

说明/提示

For the first sample, any possible choice of doing one operation will result the same three numbers 11 , 11 , 22 so the result is .

For the second sample if we multiply 88 by 33 two times we'll get 7272 . In this case the numbers will become 11 , 22 , 44 , 7272 so the OR value will be 7979 and is the largest possible result.

首页