CF1031C Cram Time

题目描述

现在你有两天的时间备考,两天各有$a$小时,$b$小时。 每天可以看若干份笔记。编号为$k$的笔记需要看$k$小时(请不要忽略,最后输出有用)。为了考得更好,你需要最大化看的笔记份数。请你求出最多能看多少份笔记。 注意,看过的笔记需要都不相同。即使是不在同一天看的。

输入格式

一行两个正整数$a$, $b$ $(0 \leq a, b \leq 10^9)$。

输出格式

一共四行。 第一行一个整数$n$表示第一天看的笔记份数。 第二行$n$个用空格隔开的正整数表示第一天看的笔记的编号。 第三行一个整数$m$表示第二天看的笔记份数。 第四行$m$个用空格隔开的正整数表示第二天看的笔记的编号。 请确保你的方案用时在$a$和$b$之内。 此题有 Special Judge。

说明/提示

In the first example Lesha can read the third note in $ 3 $ hours in the first day, and the first and the second notes in one and two hours correspondingly in the second day, spending $ 3 $ hours as well. Note that Lesha can make it the other way round, reading the first and the second notes in the first day and the third note in the second day. In the second example Lesha should read the third and the sixth notes in the first day, spending $ 9 $ hours in total. In the second day Lesha should read the first, second fourth and fifth notes, spending $ 12 $ hours in total.