U242347 平衡树测试(构造数据)

题目背景

按照最慢点排名: 1. [树状数组](https://www.luogu.com.cn/record/85380003) 2&3. [01Trie](https://www.luogu.com.cn/record/85381073) & [旋转Treap](https://www.luogu.com.cn/record/85381508) (Treap不稳定捏)。 4. [Splay](https://www.luogu.com.cn/record/85380149) 5. [线段树](https://www.luogu.com.cn/record/85380181) 6. [STL::set](https://www.luogu.com.cn/record/85380111) 7. [块状链表](https://www.luogu.com.cn/record/85380032) (应该再多插入一些或者查询构造一下就卡掉了,不过没必要) 8. [FHQ-Treap](https://www.luogu.com.cn/record/85381352) 9&10. 普通二叉查找树&暴力(BST五秒都救不了它捏QAQ随便搞个数据就卡得死死的)。

题目描述

维护一个可重集合,初始为空,有两种操作: ``0 x`` 插入 $x$ 。 ``1 x`` 查询 $x$ 的前驱(比 $x$ 小且最大的数),若没有输出 $-1$ 。 现在给定操作数 $m$ 和 $m$ 个操作,回答所有询问。

输入格式

第一行一个正整数 $m$ ,表示操作数量。 接下来 $m$ 行,每行两个整数,表示操作。

输出格式

对于所有操作 $1$ ,输出答案(一行一个)。

说明/提示

$1\leq m\leq 1\times 10^6,\ 0\leq x < 2^{29}$