1769:闯关升级

文件提交:无需freopen 内存限制:128 MB 时间限制:1.000 S
评测方式:普通裁判 命题人:
提交:8 解决:3

题目描述

小爱可以玩两个游戏,每个游戏各有 lns="http://www.w3.org/1998/Math/MathML"> 关,每过一关升一级,每关的通关时间是不同的。给定一个整数 lns="http://www.w3.org/1998/Math/MathML">,表示小爱玩游戏的时间,请问她应该如何分配时间,才能让升级的次数达到最大?

输入

第一行:两个整数 lns="http://www.w3.org/1998/Math/MathML"> 和 lns="http://www.w3.org/1998/Math/MathML">
第二行:lns="http://www.w3.org/1998/Math/MathML"> 个整数 lns="http://www.w3.org/1998/Math/MathML">1,2,,,表示第一个游戏每个关卡的通关时间;
第三行:lns="http://www.w3.org/1998/Math/MathML"> 个整数 lns="http://www.w3.org/1998/Math/MathML">1,2,,,表示第二个游戏每个关卡的通关时间。


  • 对于 lns="http://www.w3.org/1998/Math/MathML">30% 的数据,lns="http://www.w3.org/1998/Math/MathML">120
  • 对于 lns="http://www.w3.org/1998/Math/MathML">60% 的数据,lns="http://www.w3.org/1998/Math/MathML">11000
  • 对于 lns="http://www.w3.org/1998/Math/MathML">100% 的数据,lns="http://www.w3.org/1998/Math/MathML">1100000lns="http://www.w3.org/1998/Math/MathML">11,000,000,000lns="http://www.w3.org/1998/Math/MathML">1,10000


输出

单个整数:表示最多能通过多少关

样例输入-1 复制

4 22
6 8 10 7 
7 11 9 9

样例输出-1 复制

3