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



Sample input:
5 2 4


Sample output:
5
4
1
0

Submission status: Accepted

Solution code:
import collections
n,x,y = map(int,input().split())
li = []
for i in range(1,n):
  for j in range(i+1,n+1):
    i_x = abs(x-i)
    y_j = abs(j-y)
    li.append(min(j-i,i_x + y_j + 1))
c = collections.Counter(li)
for k in range(1,n):
  print(c[k])

Submission status: Accepted

Solution code:
def main():
    N, X, Y = map(int, input().split())

    dis = [0] * (N - 1)
    for i in range(N):
        for j in range(i+1, N):
            dis[min(j-i-1, abs(i+1-X) + abs(j+1-Y))] += 1
    for d in dis:
        print(d)


    return 0


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, X, Y = map(int, input().split())

ans = [0] * (N - 1)

for i in range(1, 1 + N):
    for j in range(i + 1, 1 + N):
        k = min(j - i, abs(X - i) + abs(Y - j) + 1)
        ans[k - 1] += 1

for a in ans:
    print(a)

Submission status: Accepted

Solution code:
n,x,y = map(int,input().split())
ans = [0] * (n-1)
for i in range(n):
     for j in range(i+1,n):
          a = abs(x-i-1)
          b = abs(y-j-1)
          c = abs(a+b+1)
          if j-i < c:
               ans[j-i-1] += 1
          else:
               ans[c-1] += 1
for i in range(len(ans)):
     print(ans[i])

Submission status: Accepted

Solution code:
N, X, Y = map(int, input().split())
count = [0] * N
a = 0
for i in range(1, N + 1):
    for j in range(i + 1, N + 1):
        a = min(j - i, abs(X - i) + abs(Y - j) + 1)
        count[a] += 1

for i in range(1, N):
    print(count[i])

Submission status: Accepted

Solution code:
from heapq import *
from collections import defaultdict

N,X,Y = map(int,input().split())
X -= 1
Y -= 1
cost_pri = defaultdict(list)
for i in range(N-1):
    cost_pri[i].append((i+1,1))
    cost_pri[i+1].append((i,1))
cost_pri[X].append((Y,1))
cost_pri[Y].append((X,1))
ans = [0]*(N-1)
for s in range(N):
    dist = [2**60]*N
    dist[s] = 0
    que = [(0,s)]
    heapify(que)
    while que:
        p = heappop(que)
        v = p[1]
        if dist[v] < p[0]:continue
        for e in cost_pri[v]:
            if dist[e[0]] > dist[v] + e[1]:
                dist[e[0]] = dist[v] + e[1]
                heappush(que,(dist[e[0]],e[0]))
    
    for a in dist[s+1:]:
        ans[a-1] += 1

for a in ans:
    print(a)

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n, x, y = map(int, input().split())
ans = [0] * n
for i in range(1,n):
    for j in range(i+1,n+1):
        ans[min(j - i, abs(i - x) + 1 + abs(y - j))] += 1 
for i in range(1,n):
    print(ans[i])

Submission status: Accepted

Solution code:
n, x, y = input().split(" ")
n, x, y = int(n), int(x), int(y)
ans = [0] * (n - 1)

for i in range(n - 1):
    for j in range(i + 1, n):
        now = 0
        if (j <= x - 1):
            ans[j - i - 1] += 1

        elif(j > x - 1 and j <= y - 1 and i <= x - 1):
            now = now + x - 1 - i
            if (j - (x - 1) >= (y - 1) - j + 1):
                now = now + (y - 1) - j + 1
            else:
                now = now + j - (x - 1)
            ans[now - 1] += 1

        elif(j > x - 1 and j <= y - 1 and i > x - 1):
            if (j - i >= (i - (x - 1)) + ((y - 1) - j) + 1):
                now = (i - (x - 1)) + ((y - 1) - j) + 1
            else:
                now = j - i
            ans[now - 1] += 1

        elif(j > y - 1 and i <= x - 1):
            now = now + x - 1 - i
            now = now + j - (y - 1) + 1
            ans[now - 1] += 1

        elif(j > y - 1 and i > x - 1 and i < y - 1):
            if((y - 1) - i >= i - (x - 1) + 1):
                now = now + i - (x - 1) + 1
            else:
                now = now + (y - 1) - i
            now = now + j - (y - 1)
            ans[now - 1] += 1

        elif(i >= y - 1):
            ans[j - i - 1] += 1
print(*ans)

Submission status: Accepted

Solution code:
from collections import defaultdict

n, x, y = map(int, input().split())
x -= 1
y -= 1

circle = y - x + 1
a = [0 for _ in range(circle)]
for i in range(1, circle // 2 + 1):
    a[i] = i
    a[-i] = i

dists = defaultdict(int)
for i in range(n - 1):
    if i >= y:
        for j in range(i + 1, n):
            dists[j - i] += 1
    elif x < i < y:
        for j in a[1:y - i + 1]:
            dists[j] += 1
        for j in range(1, n - y):
            dists[a[y - i] + j] += 1
    else:
        # i <= x
        for j in range(i + 1, x):
            dists[j - i] += 1
        for j in a:
            dists[x - i + j] += 1
        for j in range(1, n - y):
            dists[x - i + a[-1] + j] += 1

for i in range(1, n):
    print(dists[i])

Submission status: Accepted

Solution code:
n,x,y = map(int,input().split())
x -= 1
y -= 1

array1 = [0] * n
array2 = [0] * n

for i in range(x, y+1):
  array1[i] = min(i-x, y-i+1)
  array2[i] = min(i-x+1, y-i)

ans = [0] * (n+1)
dis = [[0 for i in range(n)] for i in range(n)]


for i in range(n):
  if i <= x:
    for j in range(i+1,n):
      if y <= j:
        tmp = (x-i) + (j-y) + 1
      elif j <= x:
        tmp = j-i
      else:
        tmp = (x-i) + array1[j]
        
      ans[tmp] += 1
      dis[i][j] = tmp
      
  elif y <= i:
    for j in range(i+1,n):
      ans[j-i] += 1
      dis[i][j] = j-i
      
  else:
    for j in range(i+1,n):
      if y <= j:
        tmp = (j-y) + array2[i]
      else:
        tmp = min(j-i, (y-x+1)-(j-i))
        
      ans[tmp] += 1
      dis[i][j] = tmp

for i in range(1,n):
  print(ans[i])

Submission status: Accepted

Solution code:
import sys
import numpy as np
from collections import deque, Counter
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, X, Y = map(int, read().split())
dist = []
for i in range(1, N):
    node = np.arange(i + 1, N + 1)

    d = np.abs(node - i)
    dd = np.abs(i - X) + np.abs(Y - node) + 1
    ddd = np.abs(i - Y) + np.abs(X - node) + 1

    acc = np.minimum(np.minimum(d, dd), ddd)

    dist.append(acc)

dist = np.concatenate(dist)

cnt = np.bincount(dist, minlength=N)
for i in range(1, N):
    print(cnt[i])

Submission status: Accepted

Solution code:
n, x, y = map(int, input().split())
A = [0 for i in range(n)]
for i in range(1, n):
    for j in range(i+1, n+1):
        t = min(j-i, abs(x-i) + abs(y-j) + 1)
        A[t] += 1
print(*A[1:], sep="\n")

Submission status: Accepted

Solution code:
# D
import numpy as np
N, X, Y = map(int, input().split())

D = [0]*N
for i in range(1, N+1):
    for j in range(i+1, N+1):
        d = min(j-i, abs(j-Y) + abs(i-X) + 1) 
        D[d] += 1
for i in range(1, N):
    print(D[i])

Submission status: Accepted

Solution code:
n,x,y=map(int,input().split())
x,y=x-1,y-1
ans=[0]*(n+1)
for i in range(n):
    for j in range(i+1,n):
        ans[min(j-i,abs(x-i)+abs(y-j)+1)]+=1
for i in range(1,n):
    print(ans[i])

Submission status: Accepted

Solution code:
n, x, y = map(int, input().split())
x = x - 1
y = y - 1
kl = [0] * (n - 1)
 
for s in range(n - 1):
    for e in range(s+1, n):
        d = e-s
        if (e <= x)or(s >= y):
            kl[d - 1] += 1
        else:
            kl[min(d, abs(s-x)+abs(e-y)+1)-1] += 1
 
for i in kl:
    print(i)

Submission status: Accepted

Solution code:
from collections import Counter
N, X, Y = map(int, input().split())
X, Y = X-1, Y-1
ans = []

for i in range(N):
    for j in range(i+1, N):
        ans.append(min(j-i, 1+abs(i-X)+abs(j-Y)))

c = Counter(ans)
for i in range(1,N):
    print(c[i])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def bfs(nodes, src):
    """ BFS(一般グラフ、重みなし) """
    from collections import deque

    N = len(nodes)
    que = deque([(src, 0)])
    dist = [INF] * N
    while que:
        u, c = que.popleft()
        if dist[u] != INF:
            continue
        dist[u] = c
        for v in nodes[u]:
            que.append((v, c+1))
    return dist

N, x, y = MAP()
x -= 1; y -= 1

nodes = [[] for i in range(N)]
for i in range(N-1):
    nodes[i].append(i+1)
    nodes[i+1].append(i)
nodes[x].append(y)
nodes[y].append(x)

distx = bfs(nodes, x)
disty = bfs(nodes, y)

G = list2d(N, N, 0)
for i in range(N):
    for j in range(i+1, N):
        G[i][j] = min(j - i, distx[i] + disty[j] + 1, distx[j] + disty[i] + 1)
ans = [0] * N
for i in range(N):
    for j in range(i+1, N):
        ans[G[i][j]] += 1
[print(a) for a in ans[1:]]

Submission status: Accepted

Solution code:
from collections import Counter
n,x,y = map(int, input().split())
x -= 1
y -= 1
ans = [0]*n
dp = [[0]*n for _ in range(n)]
for i in range(n):
    for j in range(i,n):
         ans[min(abs(i-j),(abs(i-x)+abs(j-y)+1),(abs(i-y)+abs(j-x)+1))]+=1
for k in range(1,n):
    print(ans[k])

Submission status: Accepted

Solution code:
N,X,Y=map(int,input().split())
ans=[0]*(N-1)
for i in range(1,N):
	for j in range(i+1,N+1):
		a=min(j-i,abs(i-X)+abs(Y-j)+1)
		ans[a-1]+=1
for i in range(N-1):
	print(ans[i])

Submission status: Accepted

Solution code:
N,X,Y=map(int,input().split())
ans=[0]*N
X-=1
Y-=1

for i in range(N-1):
    for j in range(i+1,N):
        ans[min(j-i,abs(j-Y)+abs(i-X)+1)]+=1

ans.pop(0)
for i in ans:
    print(i)

Submission status: Accepted

Solution code:
N, X, Y = map(int, input().split())
cnt = [0]*N

for i in range(1, N+1):
    for j in range(i+1, N+1):
        d = min(j-i, abs(X-i) + abs(Y-j) + 1)
        cnt[d] += 1

for i in range(1,N):
    print(cnt[i])

Submission status: Accepted

Solution code:
import sys
from heapq import heappop, heappush
input = sys.stdin.readline
# int(input()) # 入力が1つ
n, x, y = map(int, input().split()) # 入力が複数
graph = [[] for _ in range(n)]

for i in range(n - 1):
    graph[i].append((1, i + 1))
    graph[i + 1].append((1, i))
graph[x - 1].append((1, y - 1))
graph[y - 1].append((1, x - 1))

def dijkstra(graph, n, start):
    inf = float('inf')
    visited = [inf] * n
    visited[start] = 0
    heap = [(0, start)] #(cost, vertex)
    while heap:
        _, vertex = heappop(heap)
        for c, v in graph[vertex]:
            cost = visited[vertex] + c
            if visited[v] > cost:
                visited[v] = cost
                heappush(heap, (cost, v))
    return visited

path = []
for i in range(n):
    visited = dijkstra(graph, n, i)
    path.append(visited)

# for k in range(1, n):
#     ans = 0
#     for i in range(len(path)):
#         visited = path[i]
#         for j in range(i, len(visited)):
#             if visited[j] - visited[i] == k:
#                 ans += 1
#     print(ans)

t = [0] * n
for i in range(len(path)):
    visited = path[i]
    for j in range(i, len(visited)):
        diff = visited[j] - visited[i]
        t[diff] += 1
for k in range(1, n):
    ans = t[k]
    print(ans)

Submission status: Accepted

Solution code:
#400
N, X, Y = map(int,input().split())
L = [0]*(N)

for i in range(1,N):
    for j in range(i+1,N+1):
        if j <= X:
            L[j-i] += 1
        elif i >= Y:
            L[j-i] += 1
        elif i <= X and j >= Y:
            L[j-i - (Y-X-1)] += 1
        elif X < i < j < Y:
            if j - i <= (i-X) + (Y-j) + 1:
                L[j-i] += 1
            else:
                L[(i-X) + (Y-j) + 1] += 1
        elif i <= X < j < Y:
            if j-i < (X-i)+(Y-j)+1:
                L[j-i] += 1
            else:
                L[(X-i)+(Y-j)+1] += 1
        elif X < i < Y <= j:
            if j-i < (i-X)+(j-Y)+1:
                L[j-i] += 1
            else:
                L[(i-X)+(j-Y)+1] += 1

for i in range(N-1):
    print(L[i+1])

Submission status: Accepted

Solution code:
N,X,Y=map(int,input().split())
X-=1
Y-=1

length=[0]*(N-1)
for i in range(N-1):
    for j in range (i+1,N):
        l=min(j-i,abs(X-i)+abs(Y-j)+1)
        length[l-1]+=1
for i in range(N-1):
    print(length[i])

Submission status: Accepted

Solution code:
n,x,y = map(int,input().split())
ans = [0]*(n)

for i in range(1,n):
    for j in range(i+1,n+1):
        d = min(j-i,abs(x-i)+abs(y-j)+1)
        ans[d] += 1
for i in ans[1:]:
    print(i)

Submission status: Accepted

Solution code:
n, x, y = map(int, input().split())
D = [0] * (n - 1)
x -= 1
y -= 1
for i in range(n - 1):
  for j in range(i + 1, n):
    D[min(j - i - 1, abs(x - i) + abs(y - j))] += 1
for d in D: print(d)

Submission status: Accepted

Solution code:
N, X, Y = map(int,input().split())
X -= 1
Y -= 1

npath = [0] * (N-1)

indx = 0
for j in range(N-1):
    for i in range(j+1,N):
        if i <= X:
            distance = i - j
        elif j >= Y:
            distance = i - j
        elif j <= X and Y<= i:
            distance = i - j - (Y-X-1)
        elif  X <= j < i <= Y:
            distance = min(i-j, (j-X)+(Y-i)+1)
        elif j <= X and X < i <= Y:
            distance = (X-j) + min(i-X, Y-i+1)
        else:
            distance = (i-Y) + min(Y-j, j-X+1)
        npath[distance-1] +=1
for i in range(N-1):print(npath[i])

Submission status: Accepted

Solution code:
n, x, y = map(int, input().split())
ans = [0] + [x for x in range(n-1, 0, -1)]

# print(ans)

byd = y - x

# i < x and y < j
for i in range(1, x+1):
    for j in range(y, n+1):
        altd = j - i
        d = j - i - byd + 1
        ans[altd] -= 1
        ans[d] += 1

ld = byd + 1

# x < i, j < y
for i in range(x, y):
    for j in range(x+1, y+1):
        if i == x and j == y:
            break

        altd = j - i
        d = ld - (j - i)
        if altd > d:
            ans[altd] -= 1
            ans[d] += 1

# i < x, x < j < y
for i in range(1, x):
    for j in range(x+1, y):
        altd = j - i
        d = ld - (j - x) + (x-i)
        if altd > d:
            ans[altd] -= 1
            ans[d] += 1

# i < x < j, y < j
for i in range(x+1, y):
    for j in range(y+1, n+1):
        altd = j - i
        d = ld - (y - i) + (j - y)
        if altd > d:
            ans[altd] -= 1
            ans[d] += 1

for k in range(1, n):
    print(ans[k])

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n, x, y = MAP()
yx = y - x + 1
lnf = x
lne = n - y + 1
#print(lnf, lne)
ans = [0 for _ in range(n + 1)]
for i in range(1, n):
    for j in range(i + 1, n + 1):
        tmp = min(j - i, abs(x - i) + abs(y - j) + 1)
        ans[tmp] += 1

for k in range(1, n):
    print(ans[k])

Submission status: Accepted

Solution code:
n, x, y = map(int, input().split())
edge = [[] for _ in range(n+1)]
dist = [[abs(i-j) for i in range(n+1)] for j in range(n+1)]
counter = [0 for i in range(n)]
for i in range(1, n):
    edge[i].append(i+1)
    edge[i+1].append(i)
edge[x].append(y)
edge[y].append(x)
for i in range(y+1):
    for j in range(x, n+1):
        if j > i:
            new_dist = abs(x-i)+abs(y-j)+1
            if new_dist < dist[i][j]:
                dist[i][j] = new_dist

for i in range(1, n+1):
    for num in dist[i][i+1:]:
        counter[num] += 1
# print(dist)

for num in counter[1:]:
    print(num)

Submission status: Accepted

Solution code:
n, x, y = map(int, input().split())
x = x - 1
y = y - 1
kl = [0] * (n - 1)

for s in range(n - 1):
    for e in range(s+1, n):
        d = e-s
        kl[min(d, abs(s-x)+abs(e-y)+1)-1] += 1

for i in kl:
    print(i)

Submission status: Accepted

Solution code:
N, X, Y = [int(s) for s in input().split()]
D = [0] * (N)
for i in range(1, N+1):
    for j in range(i+1, N+1):
        d = min(j - i, abs(j - Y) + abs(i - X) + 1)
        D[d] += 1
for i in range(1, N):
    print(D[i])

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, X, Y = map(int, input().split())

ans = []

cnt = [0] * (N+1)
for a, b in itertools.combinations(range(1, N + 1), 2):
    d1 = b - a
    d2 = abs(X - a) + abs(Y - b) + 1

    d = min(d1, d2)

    cnt[d] += 1

for i in range(1, N):
    print(cnt[i])

Submission status: Accepted

Solution code:
from collections import deque
n,x,y=map(int,input().split())
G=[[10**5]*(n+2) for i in range(n+2)]
for i in range(n+2):
  G[i][i]=0
X=deque([i for i in range(1,n+1)])
Y=deque([i for i in range(1,n+1)])
V=[[0]*(n+2) for i in range(n+2)]
for i in range(1,n+1):
  V[i][i]=1
G[x][y]=1
G[y][x]=1
V[x][y]=1
V[y][x]=1
for i in range(n+2):
  V[0][i]=1
  V[n+1][i]=1
for i in range(1,n+1):
  V[i][0]=1
  V[i][n+1]=1
X.append(x)
X.append(y)
Y.append(y)
Y.append(x)
XX=[-1,0,0,1]
YY=[0,-1,1,0]
while len(X)>0:
  x=X[0]
  y=Y[0]
  X.popleft()
  Y.popleft()
  for i in range(4):
    if V[x+XX[i]][y+YY[i]]==0:
      X.append(x+XX[i])
      Y.append(y+YY[i])
      V[x+XX[i]][y+YY[i]]=1
      G[x+XX[i]][y+YY[i]]=G[x][y]+1
ans=[0]*n
for i in range(1,n+1):
  for j in range(1,n+1):
    ans[G[i][j]]+=1
for i in range(1,n):
  print(ans[i]//2)

Submission status: Accepted

Solution code:
import collections 
N,X,Y = map(int,input().split())
d = [[0]*(N+1) for _ in range(N+1)]
for i in range(1,N):#i => j
    for j in range(i+1,N+1):
        if(i>=Y or j<=X):
            d[i][j] = j-i
        elif(i<=X and j>=Y):
            d[i][j] = (X-i)+1+(j-Y)
        else:
            a_path = j-i
            b_path = abs(X-i)+1+abs(Y-j)
            d[i][j] = min(a_path,b_path)

ans = [0]
for i in range(N+1):
    ans += d[i]
c = collections.Counter(ans)
for k in range(1,N): 
    print(c[k])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush

from decimal import *

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

##### 累乗 #####
# pow(x, y, z) -> x**y % z

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N,X,Y = inputMap()
	g2 = Graph()

	for i in range(N):
		if i == 0:
			continue

		g2.add_edge(i-1, i, 1)
		if i >= X:
			g2.add_edge(i, i-1, 1)

	g2.add_edge(X-1, Y-1, 1)
	#g2.add_edge(Y-1, X-1, 1)

	ans2 = 0
	ans = []
	ansans = [0 for i in range(N)]
	for ii in range(N):
		d2 = Dijkstra(g2, ii)
		for jj in range(N):
			if ii >= jj:
				continue
			tmp2 = d2.shortest_distance(jj)

			if (jj,ii) in ans:
				continue
			#print("{} {}".format(ii+1,jj+1))
			ansans[tmp2] += 1
			#ans.append((ii,jj))

	#print(ansans)
	for i in range(1,N):
		print(ansans[i])




#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# special thanks :
#  https://nagiss.hateblo.jp/entry/2019/07/01/185421
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
class Graph(object):
    """
    隣接リストによる有向グラフ
    """

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))

    def get_nodes(self):
        return self.graph.keys()


class Dijkstra(object):
    """
    ダイクストラ法（二分ヒープ）による最短経路探索
    計算量: O((E+V)logV)
    """

    def __init__(self, graph, start):
        self.g = graph.graph

        # startノードからの最短距離
        # startノードは0, それ以外は無限大で初期化
        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0

        # 最短経路での1つ前のノード
        self.prev = defaultdict(lambda: None)

        # startノードをキューに入れる
        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            # 優先度（距離）が最小であるキューを取り出す
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(self.Q, (alt, v))

    def shortest_distance(self, goal):
        """
        startノードからgoalノードまでの最短距離
        """
        return self.dist[goal]

    def shortest_path(self, goal):
        """
        startノードからgoalノードまでの最短経路
        """
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]
        return path[::-1]

def int_sqrt2(n):
    def f(prev):
        while True:
            m = (prev + n / prev) / 2
            if m >= prev:
                return prev
            prev = m

    return f(int(math.sqrt(n) * (1 + 1e-10)))

# nCr mod m
# rがn/2に近いと非常に重くなる
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

# mを法とするaの乗法的逆元
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

# nHr mod m
# 問題によって、combination()を切り替えること
def H(n, r, mod=10**9+7):
	# comb = Combination(n+r-1, mod)
	# return comb(n+r-1, r)
    return combination(n+r-1, r, mod)

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush

from decimal import *

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

##### 累乗 #####
# pow(x, y, z) -> x**y % z

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N,X,Y = inputMap()
	g2 = Graph()

	for i in range(N):
		if i == 0:
			continue

		g2.add_edge(i-1, i, 1)
		if i >= X:
			g2.add_edge(i, i-1, 1)

	g2.add_edge(X-1, Y-1, 1)
	#g2.add_edge(Y-1, X-1, 1)

	ans2 = 0
	ans = []
	ansans = [0 for i in range(N)]
	for ii in range(N):
		d2 = Dijkstra(g2, ii)
		for jj in range(N):
			if ii >= jj:
				continue
			tmp2 = d2.shortest_distance(jj)

			#if (jj,ii) in ans:
				#continue
			#print("{} {}".format(ii+1,jj+1))
			ansans[tmp2] += 1
			#ans.append((ii,jj))

	#print(ansans)
	for i in range(1,N):
		print(ansans[i])




#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# special thanks :
#  https://nagiss.hateblo.jp/entry/2019/07/01/185421
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
class Graph(object):
    """
    隣接リストによる有向グラフ
    """

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))

    def get_nodes(self):
        return self.graph.keys()


class Dijkstra(object):
    """
    ダイクストラ法（二分ヒープ）による最短経路探索
    計算量: O((E+V)logV)
    """

    def __init__(self, graph, start):
        self.g = graph.graph

        # startノードからの最短距離
        # startノードは0, それ以外は無限大で初期化
        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0

        # 最短経路での1つ前のノード
        self.prev = defaultdict(lambda: None)

        # startノードをキューに入れる
        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            # 優先度（距離）が最小であるキューを取り出す
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(self.Q, (alt, v))

    def shortest_distance(self, goal):
        """
        startノードからgoalノードまでの最短距離
        """
        return self.dist[goal]

    def shortest_path(self, goal):
        """
        startノードからgoalノードまでの最短経路
        """
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]
        return path[::-1]

def int_sqrt2(n):
    def f(prev):
        while True:
            m = (prev + n / prev) / 2
            if m >= prev:
                return prev
            prev = m

    return f(int(math.sqrt(n) * (1 + 1e-10)))

# nCr mod m
# rがn/2に近いと非常に重くなる
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

# mを法とするaの乗法的逆元
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

# nHr mod m
# 問題によって、combination()を切り替えること
def H(n, r, mod=10**9+7):
	# comb = Combination(n+r-1, mod)
	# return comb(n+r-1, r)
    return combination(n+r-1, r, mod)

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

if __name__ == "__main__":
	main()