#Lutece1932. 一棵像样的线段树
一棵像样的线段树
Migrated from Lutece 1932 一棵像样的线段树
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
设 表示集合中最小的未出现的正整数,如 ,.
定义
$b_i = \mathrm{xem}\{b_{i-c_i}, b_{i-c_i+1},\ldots , b_{i-1}\}, \quad i = 1, 2, \ldots , n$
特别的,.
给定 和 ,请你计算出 .
Input
第一行一个整数 .
第二行 个用空格分隔的整数 ,保证 .
Output
输出一行 个用空格分隔的整数,依次为 .
Samples
6
1 2 3 1 3 4
2 3 4 1 2 5
Resources
2018 UESTC Training for Data Structures