#abc216g. G - 01Sequence
G - 01Sequence
Score : points
问题描述
考虑一个长度为 ,由 0
和 1
组成的序列 ,满足以下条件:
对于所有 ,在 这些位置上至少有 个
1
出现。
请打印出这样一个序列,使得其中 1
的出现次数达到最少。
根据约束条件,始终存在满足条件的序列。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Consider a sequence of length consisting of 0
s and 1
s, , that satisfies the following condition.
For every , there are at least occurrences of
1
among .
Print one such sequence with the fewest number of occurrences of 1
s.
There always exists a sequence that satisfies the condition under the Constraints.
Constraints
- $1 \leq M \leq \min(2 \times 10^5, \frac{N(N+1)}{2} )$
- if .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print a sequence consisting of 0
s and 1
s, with spaces in between.
It must satisfy all the requirements above.
Sample Input 1
6 3
1 4 3
2 2 1
4 6 2
Sample Output 1
0 1 1 1 0 1
Another acceptable output is 1 1 0 1 1 0
.
On the other hand, 0 1 1 1 1 1
, which has more than the fewest number of 1
s, is unacceptable.
Sample Input 2
8 2
2 6 1
3 5 3
Sample Output 2
0 0 1 1 1 0 0 0
update @ 2024/3/10 09:35:38