CodeForces 58C

同时也是 LETTers 2015 Summer II warm-up - D

#include <cstdio>
#include <iostream>

using namespace std;

const int N = 1e5 + 5;

int a[N];

int main()
{
    int n, rec, x;

    //freopen("D.in", "r", stdin);
    scanf("%d", &n);

    for (int i = 0; i < n; i++)
    {
        rec = min(i, n-i-1);
        scanf("%d", &x);
        x = x - rec;
        if (x > 0)
        {
            a[x]++;
        }
    }
    for (int i = 1; i <= 100000; i++)
    {
        rec = max(rec, a[i]);
    }

    printf("%d\n", n-rec);

    return 0;
}
添加新评论