CF460D.Little Victor and Set
提高+/省选-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Little Victor adores the sets theory. Let us remind you that a set is a group of numbers where all numbers are pairwise distinct. Today Victor wants to find a set of integers S that has the following properties:
- for all x
the following inequality holds l ≤ x ≤ r; - 1 ≤ |S| ≤ k;
- lets denote the i-th element of the set S as s__i; value
must be as small as possible.
Help Victor find the described set.
小维克多非常喜爱集合论。我们来回顾一下:集合是一组两两互不相同的数。今天,维克多希望找到一个整数集合 $ S $,使其满足以下性质:
- 对所有 $ x \in S $,均满足不等式 $ l \leq x \leq r $;
- $ 1 \leq |S| \leq k $;
- 记集合 $ S $ 的第 $ i $ 个元素为 $ s_i $;则表达式 $ \sum_{i=1}^{|S|} \sum_{j=i}^{|S|} (s_j - s_i) $ 的值应尽可能小。
请帮助维克多找出满足上述条件的集合。
输入格式
The first line contains three space-separated integers l, r, k (1 ≤ l ≤ r ≤ 1012; 1 ≤ k ≤ min(106, r - l + 1)).
第一行包含三个以空格分隔的整数 l、r、k(1≤l≤r≤1012;1≤k≤min(106,r−l+1))。
输出格式
Print the minimum possible value of f(S). Then print the cardinality of set |S|. Then print the elements of the set in any order.
If there are multiple optimal sets, you can print any of them.
输出函数 f(S) 的最小可能值。然后输出集合 ∣S∣ 的基数(即元素个数)。最后以任意顺序输出该集合的各个元素。
如果存在多个最优集合,你可以输出其中任意一个。
输入输出样例
输入#1
8 15 3
输出#1
1 2 10 11
输入#2
8 30 7
输出#2
0 5 14 9 28 11 16
说明/提示
Operation
represents the operation of bitwise exclusive OR. In other words, it is the XOR operation.
运算符
表示按位异或运算,即 XOR 运算。
输入解题思路,AI测评打分。不知道怎么写?