QOJ.ac

QOJ

Limite de temps : 1.0 s Limite de mémoire : 512 MB Points totaux : 100 Hackable ✓

#7153. 异或

Statistiques

bobo 有一个整数序列 $a_1, a_2, \dots, a_n$。他决定将该序列分成恰好 $m$ 个连续的部分。

每一部分的代价为其异或和(按位异或),而划分的总代价为各部分代价的按位或和。

请帮助 bobo 求出最小代价。

输入格式

第一行包含两个整数 $n, m$ ($1 \le n \le 200000, 1 \le m \le n$)。

第二行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$ ($0 \le a_i \le 10^9$)。

输出格式

输出一个整数,表示最小代价。

样例

输入 1

3 2
1 3 2

输出 1

1

输入 2

4 3
1 2 0 2

输出 2

3

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.