AT_abc474_d.Outweigh
普及-
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There are N types of stones, 1,2,…,N. Stones of the same type all have the same weight.
Takahashi and Aoki have Ai and Bi stones of type i, respectively.
Determine whether there exists a sequence of positive integers W=(W1,W2,…,WN) satisfying the following conditions, and if it exists, construct one such sequence.
- 1≤Wi≤1018
- If the weight of a type-i stone is Wi, the total weight of the stones Takahashi has is strictly greater than the total weight of the stones Aoki has.
共有 N 种石头,编号为 1,2,…,N。同种石头的重量均相同。
高桥和青木分别拥有类型 i 的石头 Ai 个和 Bi 个。
判断是否存在满足以下条件的正整数序列 W=(W1,W2,…,WN);若存在,请构造出一个这样的序列。
- 1≤Wi≤1018
- 若类型 i 的石头重量为 Wi,则高桥所拥有的石头总重量严格大于青木所拥有的石头总重量。
输入格式
The input is given from Standard Input in the following format:
N
A1 A2 … AN
B1 B2 … BN
输入从标准输入中按以下格式给出:
N
A1 A2 … AN
B1 B2 … BN
输出格式
If there exists W=(W1,W2,…,WN) satisfying the conditions, output it in the following format:
Yes
W1 W2 … WN
If there is no W=(W1,W2,…,WN) satisfying the conditions, output No in one line.
如果存在满足条件的 W=(W1,W2,…,WN),则按以下格式输出:
Yes
W1 W2 … WN
如果不存在满足条件的 W=(W1,W2,…,WN),则在一行中输出 No。
输入输出样例
输入#1
3 4 7 4 5 5 5
输出#1
Yes 4 7 4
输入#2
3 3 3 3 4 7 4
输出#2
No
输入#3
1 2 2
输出#3
No
说明/提示
Sample 1 Explanation:
If W=(4,7,4),
the total weight of the stones Takahashi has is 4×4+7×7+4×4=81.
The total weight of the stones Aoki has is 4×5+7×5+4×5=75.
Constraints
- 1≤N≤105
- 1≤Ai≤109
- 1≤Bi≤109
- All input values are integers.
样例 1 解释:
若 W=(4,7,4),
则高桥所持石子的总重量为 4×4+7×7+4×4=81。
而青木所持石子的总重量为 4×5+7×5+4×5=75。
限制条件
- 1≤N≤105
- 1≤Ai≤109
- 1≤Bi≤109
- 所有输入值均为整数。
输入解题思路,AI测评打分。不知道怎么写?