QOJ.ac

QOJ

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

#7964. 转化

الإحصائيات

题目背景

小 E 在玩 Somzig 游戏的时候因为操作时间不够绷不住了,于是就有了这个题。

题目描述

小 E 有 $n$ 种颜色的球,其中第 $i$ 种有 $a_i$ 个。有两类工具,第一类可以把一个指定颜色的球变成一个任意颜色的球;第二类可以把一个指定颜色的球变成两个这种颜色的球。一个变化之后的球也可以通过工具产生新的变化。关于第 $i$ 种颜色的第一类工具有 $b_i$ 个,第二类工具有 $c_i$ 个。小 E 想知道,如果每一工具最多只能使用一次,那么对于每种颜色 $i$,第 $i$ 种颜色的球最后最多能有多少个。以及,小 E 最后最多能有多少个球。

输入格式

从标准输入读入数据。

第一行一个正整数 $n$。

第二行 $n$ 个整数,其中第 $i$ 个表示 $a_i$。

第三行 $n$ 个整数,其中第 $i$ 个表示 $b_i$。

第四行 $n$ 个整数,其中第 $i$ 个表示 $c_i$。

输出格式

输出到标准输出。

第一行 $n$ 个整数,其中第 $i$ 个表示如果每个工具最多使用一次,那么小 E 最后第 $i$ 种颜色的球最多有多少个。

第二行一个整数,表示如果每个工具最多使用一次,那么小 E 最后最多能有多少个球。

样例1输入

2
1 2
1 2
1 0

样例1输出

4 3
4

子任务

保证 $1\le n \le 351493$。

保证 $0\le a_i,b_i,c_i\le 10^9$。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.