Problem:
Score : 400 points

Problem Statement

We have an undirected graph G with N vertices numbered 1 to N and N edges as follows:

For each i=1,2,...,N-1, there is an edge between Vertex i and Vertex i+1.

There is an edge between Vertex X and Vertex Y.

For each k=1,2,...,N-1, solve the problem below:

Find the number of pairs of integers (i,j) (1 \leq i < j \leq N) such that the shortest distance between Vertex i and Vertex j in G is k.

Constraints

3 \leq N \leq 2 \times 10^3

1 \leq X,Y \leq N

X+1 < Y

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N X Y

Output

For each k=1, 2, ..., N-1 in this order, print a line containing the answer to the problem.

Sample Input 1

5 2 4

Sample Output 1

5
4
1
0

The graph in this input is as follows:

There are five pairs (i,j) (1 \leq i < j \leq N) such that the shortest distance between Vertex i and Vertex j is 1: (1,2)\,,(2,3)\,,(2,4)\,,(3,4)\,,(4,5).

There are four pairs (i,j) (1 \leq i < j \leq N) such that the shortest distance between Vertex i and Vertex j is 2: (1,3)\,,(1,4)\,,(2,5)\,,(3,5).

There is one pair (i,j) (1 \leq i < j \leq N) such that the shortest distance between Vertex i and Vertex j is 3: (1,5).

There are no pairs (i,j) (1 \leq i < j \leq N) such that the shortest distance between Vertex i and Vertex j is 4.

Sample Input 2

3 1 3

Sample Output 2

3
0

The graph in this input is as follows:

Sample Input 3

7 3 7

Sample Output 3

7
8
4
2
0
0

Sample Input 4

10 4 8

Sample Output 4

10
12
10
8
4
1
0
0
0

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
//全ての頂点からBFS
class Program
{
    public static readonly int INF = 1001001001;
    static void Main(string[] args)
    {
        string[] In = Console.ReadLine().Split(' ');
        int n = int.Parse(In[0]);
        int x = int.Parse(In[1]);
        int y = int.Parse(In[2]);
        x--; y--;
        var ans = new int[n];
        for (int k = 0; k < n; k++)//頂点全てから開始
        {
            var dist = new int[n];
            dist = Enumerable.Repeat(INF, n).ToArray();
            var q = new Queue<int>();
            Enqueue(k, 0, dist, q);
            while (q.Count != 0)
            {
                int v = q.Dequeue();
                int d = dist[v];
                if (v - 1 >= 0) Enqueue(v - 1, d + 1, dist, q);
                if (v + 1 < n) Enqueue(v + 1, d + 1, dist, q);
                if (v == x) Enqueue(y, d + 1, dist, q);
                if (v == y) Enqueue(x, d + 1, dist, q);
            }
            for (int i = 0; i < n; i++)
            {
                ans[dist[i]]++;
            }
        }
        for(int i = 1; i <= n - 1; i++)
        {
            Console.WriteLine(ans[i]/2);
        }
    }
    static void Enqueue(int v, int d, int[] dist,Queue<int> q)
    {
        if (dist[v] != INF) return;
        dist[v] = d;
        q.Enqueue(v);
    }
}
//class Program
//{
//    public static readonly int INF = 1001001001;
//    static void Main(string[] args)
//    {
//        string[] In = Console.ReadLine().Split(' ');
//        int n = int.Parse(In[0]);
//        int x = int.Parse(In[1]);
//        int y = int.Parse(In[2]);
//        var L = new List<int>[n-1];//縦n横Listの二次元配列
//        for(int i=0;i<n-1; i++)
//        {
//            L[i] = new List<int>() {};
//        }
//        for(int i = 0; i < n-1; i++)
//        {
//            L[i].Add(i + 2);
//            if (i == x-1)
//            {
//                L[i].Add(y);
//            }
//        }
//        var q = new Queue<int>();
//        var dist = new List<int>();
//        for(int i=0; i < n; i++)
//        {
//            dist.Add(INF);
//        }
//        dist[0] =0;
//        int[] C = new int[n-2];
//        for(int k = 1; k < n; k++)
//        {
//            q.Enqueue(k-1);
//            int v;
//            while (q.Count != 0)
//            {
//                v = q.Dequeue();
//                foreach(int u in L[v])
//                {
//                    if (dist[u] != INF) continue;
//                    dist[u] = dist[v] + 1;
//                    C[dist[u] - 1]++;
//                    if(u<n-1)q.Enqueue(u);
//                }
//            }

//        }
//        for(int i = 0; i < C.Length; i++)
//        {
//            Console.WriteLine(C[i] / 2);
//        }
//    }
//}



//class Program
//{
//    static void Main(string[] args)
//    {
//        string[] In = Console.ReadLine().Split(' ');
//        int n = int.Parse(In[0]);
//        int x = int.Parse(In[1]);
//        int y = int.Parse(In[2]);
//        int[][] J = new int[n-1][];
//        for(int i = 0; i < n-1; i++)//最後の頂点には次の頂点ない
//        {
//            if (i == x - 1) J[i] = new int[] { i + 2, y };
//            else J[i] = new int[] { i + 2 };
//        }
//        for(int k = 0; k <= n - 1; k++)
//        {
//            int cnt;
//            for(int i=0; i < n - 1; i++)
//            {
//                for(int j = 0; j <= 1; j++)
//                {
//                    if(J[i,j].E)
//                }
//                if(DFS(J,k))
//            }
//        }
//    }
//    public static bool

//}