#include<map>
#include<set>
#include<list>
#include<stack>
#include<queue>
#include<cmath>
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define endl '\n'
typedef long long ll;
const int N = 5e5 + 10;
const double PI = acos(-1.0);
typedef unsigned long long ull;
void print(ll x){if(x<0){putchar('-');x=-x;}if(x>9){print(x/10);}putchar(char(x%10+'0'));}
void print(int x){if(x<0){putchar('-');x=-x;}if(x>9){print(x/10);}putchar(char(x%10+'0'));}
void print(string s){int n=s.length();for(int i=0;i<n;i++)putchar(s[i]);}
inline int read_int() {int f=1,x=0;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}while(isdigit(ch)){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}return x*f;}
inline ll read_ll() {int f=1;ll x=0;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}while(isdigit(ch)){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}return x*f;}
inline string read_str(){string x="";char ch=getchar();while(ch==' '||ch==' '||ch=='\n'||ch=='\r')ch=getchar();while(ch!=' '&&ch!=' '&&ch!='\n'&&ch!='\r'){x+=ch;ch=getchar();}return x;}
// ----------------------------
// ----------------------------
int a[N];
int b[N];
// ----------------------------
int main() {
int n = read_int();
for (int i=1;i<=n;i++) {
a[i] = read_int();
a[i] += i - 1;
a[i] -= n - i;
b[i] = a[i];
}
// ------------------------
for (int i=1;i<=n;i++) b[i] -= a[i-1];
for (int i=1;i<=n;i++) {
if (a[i] < 0) {
int k = -a[i];
b[n-k+1]--;
b[i] += k;
b[i+1] -= k;
}
}
// ------------------------
for (int i=1;i<=n;i++) {
b[i] += b[i-1];
print(b[i]);
putchar(' ');
}
return 0;
}
用差分做的,过不了样例3。