QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 64 MB Total points: 100

#13310. 仓库商店

Statistics

Byteasar 经营着一家实体仓库商店。本季度最畅销的商品是强化地板,它占了商店收入的大部分。不幸的是,经常会有客户下的订单因仓库中木板数量不足而无法满足。为了防止客户流失,Byteasar 决定尽量减少此类事件的发生。

为此,他制定了接下来 $n$ 天的工作计划。他分析了与地板生产商的合同,并据此确定了一个序列 $a_{1},a_{2},…,a_{n}$。数字 $a_{i}$ 表示在第 $i$ 天的早晨将有 $a_{i}$ 包木板运送到仓库。

Byteasar 还整理了一份批发商的订单表,并据此确定了另一个序列 $b_{1},b_{2},…,b_{n}$。数字 $b_{i}$ 表示在第 $i$ 天的中午,一位客户将订购 $b_{i}$ 包木板。如果 Byteasar 决定履行该订单,他就必须提供相应数量的木板。如果在订单下达时仓库中的木板数量不足,Byteasar 必须拒绝该订单。另一方面,如果木板数量充足,Byteasar 可以自行决定是否接受该订单。

基于这些数据,Byteasar 希望确定他应该接受哪些订单,以使他拒绝的订单总数(无论是主动选择还是被迫拒绝)最小化。我们假设在第一天清晨,仓库最初是空的。

输入格式

标准输入的第一行包含一个整数 $n$ ($1 \le n \le 250\,000$)。第二行包含一个整数序列 $a_{1},a_{2},…,a_{n}$ ($0 \le a_{i} \le 10^{9}$)。第三行包含一个整数序列 $b_{1},b_{2},…,b_{n}$ ($0 \le b_{i} \le 10^{9}$)。第二行和第三行中的数字由空格分隔。

在占总分 50% 的测试用例中,额外满足 $n \le 1\,000$。

输出格式

第一行应输出一个整数 $k$,表示 Byteasar 可以接受的最大订单数量。第二行应输出 $k$ 个递增的数字,由空格分隔,表示为了达到该目标所应接受的订单编号。如果无法接受任何订单,第二行应为空。客户按其下订单的时间顺序从 $1$ 到 $n$ 编号。如果存在多个正确答案,程序可以任意输出其中一个。

样例

输入

6
2 2 1 2 1 0
1 2 2 3 4 4

输出

3
1 2 4

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.