欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1471A.Strange Partition
Strange Partition
You are given an array of length , and an integer . You can perform the following operation as many times as you would like (possibly zero): replace two adjacent elements of the array by their sum. For example, if the initial array was , in a single operation one can replace the last two elements by their sum, yielding an array , or replace the first two elements to get an array . Note that the size of the array decreases after each operation.
The beauty of an array is defined as , which means that we divide each element by , round it up to the nearest integer, and sum up the resulting values. For example, if , and the array is , the beauty of the array is equal to $\left\lceil \frac{4}{3} \right\rceil + \left\lceil \frac{11}{3} \right\rceil + \left\lceil \frac{6}{3} \right\rceil = 2 + 4 + 2 = 8$.
Please determine the minimum and the maximum beauty you can get by performing some operations on the original array.
Input
The first input line contains a single integer — the number of test cases ().
The first line of each test case contains two integers and (, ).
The next line contains integers (), the elements of the array .
It is guaranteed that the sum of values of over all test cases does not exceed .
Output
For each test case output two integers — the minimal and the maximal possible beauty.
Note
In the first test case the beauty of the array does not change if we perform any operations.
In the second example we can leave the array unchanged to attain the maximum beauty, and to get the minimum beauty one can replace two elements and with their sum, yielding an array , which has its beauty equal to .
Samples
2
3 3
3 6 9
3 3
6 4 11
6 6
7 8
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |