import java.util.Scanner;
class Main{
public static void main
(String[] args
) { final int MAX = 100001;
Scanner sc
= new Scanner
(System.
in); int amount_of_pltf = sc.nextInt();
int[] energy, platforms, list_of_pltf;
int[] heights = new int[MAX];
for (int i = 1; i <= amount_of_pltf; i++) heights[i] = sc.nextInt();
energy = new int[MAX];
platforms = new int[MAX];
energy[1] = 0;
energy
[2] = Math.
abs(heights
[2] - heights
[1]); platforms[1] = -1;
platforms[2] = 1;
//В цикле вычисляем значения ячеек energy[j] и platforms[j](3 ≤ j ≤ amount_of_pltf)
for (int j = 3; j <= amount_of_pltf; j++){
if((energy
[j
-1] + Math.
abs(heights
[j
] - heights
[j
-1])) < (energy
[j
-2] + 3 * Math.
abs(heights
[j
] - heights
[j
-2]))){ energy
[j
] = energy
[j
-1] + Math.
abs(heights
[j
] - heights
[j
-1]); platforms[j] = j - 1;
} else {
energy
[j
] = energy
[j
-2] + 3 * Math.
abs(heights
[j
] - heights
[j
-2]); platforms[j] = j - 2;
}
}
//В переменной final_amount вычисляем конечное количество платформ, по которым нужно пройти.
int final_amount = 0;
list_of_pltf = new int[MAX];
for (int l = amount_of_pltf; l > 0; l = platforms[l]) list_of_pltf[final_amount++] = l;
System.
out.
println(energy
[amount_of_pltf
] + "\n" + final_amount
); for(int k
= final_amount
- 1; k
>= 0; k
--) System.
out.
print(list_of_pltf
[k
] + " "); }
}
aW1wb3J0IGphdmEudXRpbC5TY2FubmVyOwoKY2xhc3MgTWFpbnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB7CgkJZmluYWwgaW50IE1BWCA9IDEwMDAwMTsKCQlTY2FubmVyIHNjID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKICAgICAgICBpbnQgYW1vdW50X29mX3BsdGYgPSBzYy5uZXh0SW50KCk7CiAgICAgICAgaW50W10gZW5lcmd5LCBwbGF0Zm9ybXMsICBsaXN0X29mX3BsdGY7CiAgICAgICAgaW50W10gaGVpZ2h0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