logo AlgoBeat OnlineJudge
登录 注册

#217099. [ICPC 2017 Xi'an R] Naomi with Array

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Now Naomi is facing another math problem.

Naomi has an -indexed array which contains different non-negative numbers. She needs to move the numbers to make the array in descending order. Each move Naomi can choose , and move the number of position to position with cost .

Suppose she moves the number of position to position :

  • If , move to one by one.
  • If , move to one by one.

Naomi wants to minimize the sum of costs from each move. But it’s not enough, Naomi wants to know how many moves at least (also the sum of costs should be minimal).

输入格式

The input contains multiple test cases. (No more than )

In each test case:

The first line contains one number ().

The following line contains numbers denoting array . Each number in array will be less than .

输出格式

For each test case, print the minimum sum of the costs and the minimum moves in a single line. Separate them by one space.

样例

样例输入 1

5
10 13 4 8 7

样例输出 1

11 2