当前位置:网站首页>Cf:b. array determinations
Cf:b. array determinations
2022-06-11 18:47:00 【Review of the white speed Dragon King】

analysis
according to a and b Value , Find the maximum value that can be deleted
Then for all a All minus this maximum , If it is less than 0 Then take 0
Look at this result and b Whether it is consistent or not
ac code
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
maxReduce = 0
for i in range(n):
maxReduce = max(maxReduce, a[i] - b[i])
expectedB = []
for i in range(n):
now = max(0, a[i] - maxReduce)
expectedB.append(now)
if expectedB != b:
print('NO')
else:
print('YES')
summary
Maximum simulation
边栏推荐
- Specific methods for JS to realize full screen display
- 牛客刷题——把字符串转换成整数
- Make a static tank
- 牛客刷题——两种排序方法
- MySQL in-depth and complete learning - stage 1 - overview of learning
- Surveillance des fonctions de perte avec visdom
- map和set
- . Net core redis hyperloglog type
- Non recursive traversal of binary tree
- 力扣刷题——二叉树的层序遍历
猜你喜欢

Cool visualization tool: first introduction to processing

On the problem that the while loop condition in keil does not hold but cannot jump out
開發中必備的文件的上傳與下載

全志科技T3開發板(4核ARM Cortex-A7)——MQTT通信協議案例

力扣刷题——根据二叉树创建字符串

*Jetpack notes understanding of lifecycle ViewModel and livedata

全志T3开发板(4核ARM Cortex-A7)——系统启动阶段LOGO显示详解
Mysql深入完全学习---阶段1---学习总述

2022-2023 MEM pre approval interview notice of School of management, Xi'an Jiaotong University

Signal processing and capture
随机推荐
Apipost精妙使用技巧
Uni app Muke hot search project (I) production of tabbar
Combination sum of 39 questions
Overall process of software development
cf:D. Black and White Stripe【连续k个中最少的个数 + 滑动窗口】
In 2023, the MPAcc of School of management of Xi'an Jiaotong University approved the interview online in advance
Cool visualization tool: first introduction to processing
牛客刷题——求最小公倍数
记录一下phpstudy配置php8.0和php8.1扩展redis
Prevent enemy tanks from overlapping
美国通胀率8.6%创41年历史新高!通胀高烧不退?股票、加密市场先跌为敬!
Add your favorite background music
Specific methods for JS to realize full screen display
炫酷的可视化工具:processing 初识
「案例分享」基于 AM57x+ Artix-7 FPGA开发板——PRU开发手册详解
Quanzhi technology T3 development board (4-core arm cortex-a7) - mqtt communication protocol case
BigDecimal基本使用与闭坑介绍
为何TI的GPMC并口,更常被用于连接FPGA、ADC?我给出3个理由
牛客刷题——part6
kubernetes 二进制安装(v1.20.15)(九)收尾:部署几个仪表盘