#include<stdio.h> #include<stdlib.h> int main() { int n; int i = 0; int j = 0; scanf("%d",&n); int flag; int* p = (int*)malloc(n*sizeof(int)); for(i = 1;i<=n;i++) { scanf("%d",p+i); } p[0] = 0; for(j = 0;j<...