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: Wrong Answer

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

# x, yを使うルート＋飛ばされたところを含むルート
# x, yを使った場合の端から端の距離
dis_xy = n - (y - x) + 1
# x,y間の数aについて、xに近い点数、yに近い点数、等距離の点数を計算
near_x = (y - x - 1) // 2
near_y = (y - x - 1) // 2
equal_xy = (y - x - 1) % 2

for k in range(1, n):
    c_xy = max(0, dis_xy - k)
    tmp1 = max(0, near_x + 1 - k)
    tmp2 = max(0, min(near_x, x + near_x - k)) - tmp1
    tmp3 = max(0, min(near_x, (n - y + 2) + near_x - k)) - tmp1
    tmp4 = max(0, near_y + 1 - k)
    tmp5 = max(0, min(near_y, (n - y + 1) + near_y - k)) - tmp4
    tmp6 = max(0, min(near_y, (x + 1) + near_y - k)) - tmp4
    tmp7 = 0
    if equal_xy == 1:
        z = (x + y) // 2
        if z - k > 0:
            tmp7 += 1
        if (n - z + 1) - k > 0:
            tmp7 += 1
    tmp8 = 0
    if (y - x + 1) >= 2 * k:
        tmp8 = (y - x + 1) - tmp1 - tmp4
        if equal_xy == 1:
            if z - k >= x:
                tmp8 -= tmp7
        z = (x + y) // 2
        if (y - (z + 1) + 1) >= k:
            if k > 1:
                tmp8 -= 2
            else:
                tmp8 -= 1
        tmp8 = max(0, tmp8)
    else:
        tmp8 = 0
#    print(c_xy, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8)
    print(c_xy + tmp1 + tmp2 + tmp3 + tmp4 + tmp5 + tmp6 + tmp7 + tmp8)

Submission status: Wrong Answer

Solution code:
N, X, Y= map(int, input().split()) 
Count = []
for i in range(N-1):
  Count.append(0)
  
for k in range(1, N):
  for i in range(1, N):
    for j in range(i+1, N+1):
      if (j-i > k+1) & ((abs(i-X) +abs(j-Y) +1)>k+1):
        break
      if j-i <= (abs(i-X) +abs(j-Y) +1):
        if j-i == k:
          Count[k-1] = Count[k-1]+1
      else:
        if (abs(i-X) +abs(j-Y) +1) == k:
          Count[k-1] = Count[k-1]+1

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

Submission status: Wrong Answer

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

l = [0] * (N)

graph = [[0] * N] * N

for i in range(1, N+1):
    for j in range(i+1, N+1):
        if i < X:
            distAX = X - i
        else:
            distAX = i - X            
        if j < Y:
            distBY = Y - j
        else:
            distBY = j -Y
        distAB = j - i
        if distAX + distBY + 1 < distAB:
            distAB = distAX + distBY + 1
        
        print(i, j, distAX, distBY, distAB)

        l[distAB] = l[distAB] + 1

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

Submission status: Wrong Answer

Solution code:
from collections import deque
def bfs(start):
    global count
    d = [float('inf') for i in range(N)]
    d[start] = 0
    que = deque()
    que.append(start)
    alr = [start]
    while que:
        q = que.popleft()
        c = d[q]
        for i in path[q]:
            if i not in alr:
                que.append(i)
                alr.append(i)
                d[i] = c+1

N,X,Y = map(int,input().split())
path = [[] for i in range(N)]
path[0] = [1]
path[N-1] = [N-2]
for i in range(1,N-1):
    path[i] = [i-1,i+1]
path[X-1].append(Y-1)
path[Y-1].append(X-1)

count = [0 for i in range(N-1)]
for i in range(N-1):
    bfs(i)
for i in range(N-1):
    print(count[i])

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

n, X, Y = [int(x) for x in input().split()]

ans = [0] * (n) # 1 ~ n - 1

g = [x for x in range(1, n + 1)]
g_2 = [x for x in range(1, n + 1)]
g_2[Y - 1] = X + 1
for i in range(Y, n):
    if i < n:
        g_2[i] -= (Y - X - 1)
# print(g)
# print(g_2)

for i in range(X):
    for j in range(i + 1, n):
        # print(g_2[j], g[i])
        b = min(g_2[j] - g[i], g[X - 1] - g[i] + g_2[Y - 1] - g[X - 1] + abs(g[Y - 1] - g[j]))
        ans[b] += 1

for i in range(X, Y):
    for j in range(i + 1, n):
        # print(g[j], g[i])
        a = min(g[j] - g[i], g[i] - 2 * g[X - 1] + g_2[j])
        ans[a] += 1

for i in range(Y, n):
    for j in range(i + 1, n):
        # print(g[j], g[i])
        ans[g[j] - g[i]] += 1

for i in ans[1:]:
    print(i)

Submission status: Wrong Answer

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

d = {}

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

ans = [0] *(N - 1)

for k, v in d.items():
    ans[v - 1] += 1

for v in ans:
    print(v)

Submission status: Wrong Answer

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

# N = 5
# X = 2
# Y = 4

dist = np.full(N*N, float("inf")).reshape((N, N))
np.fill_diagonal(dist, 0)
np.fill_diagonal(dist[1:], 1)
np.fill_diagonal(dist[:, 1:], 1)
dist[X-1, Y-1] = 1
dist[Y-1, X-1] = 1
for i in range(N):
    for j in range(N):
        for k in range(N):
            dist[i, j] = min(dist[i, j], dist[i, k]+dist[k, j])
# print(dist)
for i in range(1, N):
    count = np.count_nonzero(dist == i)//2
    print(count)

Submission status: Wrong Answer

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

def check(i, j):
    a = j-i
    short = abs(x-i) + 1 + abs(j-y)
    if a==short:
        ans[a-1] += 2
    else:
        mini = min(a, short)
        ans[mini-1] += 1
for i in range(1, n):
    for j in range(i+1, n+1):
        check(i,j)


print(ans)

Submission status: Wrong Answer

Solution code:
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
input = sys.stdin.readline
#文字列のときはうまく行かないのでコメントアウトすること
sys.setrecursionlimit(2147483647)

def main():
  n, x, y = map(int, input().split())
  n2 = n-y+x+1
  A = [i for i in range(1,n+1)]
  B = A[:x] + A[y-1:]
  for k in range(1,n):
    s = set()
    for i in range(n):
      if i+k < n:
        s.add((A[i],A[i+k]))
      if i+k < n2:
        s.add((B[i], B[i+k]))
    print(len(s))

if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
import numpy as np
a,b,c=map(int,input().split())
half_a=a//2
if a==c and b==1:


    for n in range(1,a):
        if n<=half_a:
            print(a)
        else:
            print(0)

if b==1 and a!=c:
    half_c=c//2
    a_c=a-c
    for n in range(1,a):
        if n==1:
            print(a)
        elif n<=half_c:
            print(c+2*(n-1)+a_c//n)
        elif n<=half_c+a_c:
            print(2*(half_c+a_c+1-n)+a_c//n)
        else:
            print(0)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

for k in range(1, n):
    cnt = 0
    for i in range(1, n):
        for j in range(i+1, n+1):
            if x < i:
                if j < y:
                    d = j - i
                else:
                    d = min(j - i, (i - x) + 1 + (j - y))
            elif j < y:
                if x < i:
                    d = j - i
                else:
                    d = min(j - i, (x - i) + 1 + (y - j))
            else:
                d = j - i - (y - x - 1)
            if d == k:
                cnt += 1
    print(cnt)

Submission status: Wrong Answer

Solution code:
n, x, y = map(int, input().split())
x, y = x - 1, y - 1
for k in range(1, n):
    count = 0
    for i in range(n - k):
        x_i = abs(i - x)
        flag = True
        if x_i < k:
            points = {y + k - x_i - 1, y - k + x_i + 1}
            for p in points:
                if n > p > i + k:
                    count += 1
        if x_i+1+abs(i+k-y)>k:
            count += 1
    print(count)

Submission status: Wrong Answer

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

def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

##############################

d = [[float("inf")]*n for i in range(n)] 
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(n):
  for j in range(n):
    if i+1==j or (i==x-1 and j==y-1) or i==j+1 or (i==y-1 and j==x-1):
      d[i][j] = 1
      d[j][i] = 1
for i in range(n):
    d[i][i] = 0 #自身のところに行くコストは０
tmp = warshall_floyd(d)
from collections import defaultdict
ans = [0]*(n+1)
for i in range(n):
  for j in range(n)[i+1:]:
    ans[d[i][j]]+=1
for a in ans[1:]:
  print(a)

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    import collections
    
    N, X, Y = map(int, sys.stdin.readline().split())
    
    dist_list = []
    
    if X == 1 and Y == N:
        for _ in range(1, N):
            print(N)
    
    else:
        for i in range(1, N):
            for j in range(i + 1, N + 1):
                if j <= X or i >= Y:
                    dist_list.append(j - i)
                else:
                    dist = min(j - i, abs(X - i) + abs(j - Y) + 1)
                    dist_list.append(dist)
                    
        
        c = collections.Counter(dist_list)
        for i in range(1, N):
            print(c[i])
            
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n,x,y = map(int,input().split())
a = [0 for i in range(1,n)]
l=y-x;m= max(x-1+l//2,x+n-y)
x-=1;y-=1
for i in range(n):
  for j in range(i+1,n):
    if i+1==j:
      a[0]+=1
    else:
      k = j-i
      if i<=x and j>=y:
      	k=k-l+1
      elif i>=x and j<=y:
        k=min(k,(l+1)-k)
      elif i<=x:
        k=x-i+min((j-x),(l+1)-(j-x))
      else:
        k = j-y+min(y-i,(l+1)-(y-i))  

      a[k-1]+=1
for i in a:
  print(a)

Submission status: Wrong Answer

Solution code:
import copy

N, X, Y = map(int, input().split())
def check(num, distance):
    if num!=0:
        distance[num-1]=min(distance[num]+1, distance[num-1])
    if num!=N-1:
        distance[num+1]=min(distance[num+1], distance[num]+1)
    if num==X-1:
        distance[Y-1]=min(distance[Y-1], distance[X-1]+1)
    elif num==Y-1:
        distance[X-1] = min(distance[X-1], distance[Y-1]+1)
total_answer=[]
answer=[N]*N
for k in range(N):
    temp=copy.copy(answer)
    temp[k]=0
    #print(temp)
    for _ in range(3):
        for i in range(0, N):
            check(i, temp)
            #print(temp)
        #print(temp)
        for j in range(N-1,-1,-1):
            check(j, temp)
        #print(temp)
        #print('/n')

#print(total_answer)
import collections
dict=collections.Counter(total_answer)
#print(dict)
for i in range(1, N):
    print(dict[i]//2)

Submission status: Wrong Answer

Solution code:
import numpy as np
n, x, y =  list(map(int, input().split()))

r = y - x - 1
left = x
right = n - y + 1
base = left + right
arr = np.array([0] * (n - 1))
for k in range(base):
    arr[k] += base - k - 1
for k in range(r):
    arr[k] += r - k - 1

    
if r % 2 == 0:
    arr_r = [1] + [2] * ((r // 2) - 1)  + [1]
else:
    arr_r = [1] + [2] *(r // 2)
    
arr = np.array(arr)
for k in range(right):
    arr[k : k + len(arr_r)] += arr_r
for k in range(left):
    arr[k : k + len(arr_r)] += arr_r

for a in arr:
    print(a)

Submission status: Wrong Answer

Solution code:
NXY = list(map(int, input().split()))
N = NXY[0]
X = NXY[1]
Y = NXY[2]
 
mini = 0
if N-Y<X-1:
    mini = N-Y+1
else:
    mini = X
 
print(N)
 
for i in range(N-2):
    k = i + 2
    if k < Y - X:
        if k<=mini:
            print(N)
        else:
            print(N-k+mini)
    else:
        r = 0
        if k < Y-1:
            r += Y-1-k
           
        if N-X>k:
            r+=N-X-k
            
        if N-Y+X>=k:
            print(r+N-Y+X-k+1)
        else:
            print(r)

Submission status: Wrong Answer

Solution code:
N, X, Y= map(int, input().split()) 
Count = []
for i in range(N-1):
  Count.append(0)
  
for k in range(1, N):
  for i in range(1, N):
    for j in range(i+1, N+1):
      if j-i <= (abs(i-X) +abs(j-Y) +1):
        if j-i > k+1:
          break
        if j-i == k:
          Count[k-1] = Count[k-1]+1
      else:
        if (abs(i-X) +abs(j-Y) +1) > k+1:
          break
        if (abs(i-X) +abs(j-Y) +1) == k:
          Count[k-1] = Count[k-1]+1

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

Submission status: Wrong Answer

Solution code:

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

dis = [[0  for i in range(N)] for i in range(N)]

k = [0 for i in range(N)]

for i in range(N):
    for j in range(N):
        dis[i][j] = abs(j - i)

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

for i in range(N):
    for j in range(N):
        if i < j:
            k[dis[i][j]-1] = k[dis[i][j]-1] + 1
        else:
            continue

for i in range(len(k)-1):
    print(k[i])

Submission status: Wrong Answer

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,x,y=INTM()
    z=y-x
    sc=y-x-1
    loop=y-x+1
    maxl=(n)-(y-x)
    for i in range(1,n):
        ct=0
        if ct==0:
            for j in range(1,n):
                if j+i<=x or j>=y:
                    if j+i<=n:
                        ct+=1
                else:
                    if j<=x:
                        if j+i+sc<=n:
                            ct+=1
                        temp=i-(x-j)
                        if loop>temp*2:
                            ct+=2
                        elif loop==temp*2:
                            ct+=1
                        
                    else:
                        lpmin=min(y-j,+(j-x+1))
                        if lpmin==j-x+1:
                            if lpmin==y-j:
                                if lpmin+i<=n:
                                    ct+=1
                            else:
                                if lpmin>=i:
                                    ct+=1
                                else:
                                    if lpmin+i<=n:
                                        ct+=1
                                    if loop>i*2:
                                        ct+=2
                                    elif loop==i*2:
                                        ct+=1
            print(ct)        
        else:
            print(ct)
                
        
if __name__ == '__main__':
    do()

Submission status: Wrong Answer

Solution code:
inf = int(10e9)
n, x, y = map(int, input().split())
dp = [[1 if abs(i - j) == 1 and i > j else inf for j in range(n)] for i in range(n)]
ans = [0 for _ in range(n)]
ans[1] = n
for i in range(n):
    dp[i][i] = 0
dp[y - 1][x - 1] = 1
for i in range(2, n):
    for j in range(i - 2, -1, -1):
        dp[i][j] = min(dp[i][j], dp[i - 1][j] + 1, dp[i][j + 1] + 1)
        if dp[i][j] != 1:
            ans[dp[i][j]] += 1
for i in range(n - 2, 2, -1):
    for j in range(i - 2, -1, -1):
        cur = dp[i][j]
        cnd = dp[i + 1][j] + 1
        if cnd < cur:
            dp[i][j] = cnd
            ans[cur], ans[cnd] = ans[cur] - 1, ans[cnd] + 1
for i in range(n - 1, 2, -1):
    for j in range(i - 2, 1, -1):
        cur = dp[i][j]
        cnd = dp[i][j - 1] + 1
        if cnd < cur:
            dp[i][j] = cnd
            ans[cur], ans[cnd] = ans[cur] - 1, ans[cnd] + 1
[print(a) for a in ans[1:]]

Submission status: Wrong Answer

Solution code:
import copy

N, X, Y = map(int, input().split())
def check(num, distance):
    if num!=0:
        distance[num-1]=min(distance[num]+1, distance[num-1])
    if num!=N-1:
        distance[num+1]=min(distance[num+1], distance[num]+1)
    if num==X-1:
        distance[Y-1]=min(distance[Y-1], distance[X-1]+1)
    elif num==Y-1:
        distance[X-1] = min(distance[X-1], distance[Y-1]+1)
total_answer=[]
answer=[N]*N
for k in range(N):
    temp=copy.copy(answer)
    temp[k]=0
    #print(temp)
    for i in range(0, N):
        check(i, temp)
        #print(temp)
    #print(temp)
    for j in range(N-1,-1,-1):
        check(j, temp)
    #print(temp)
    #print('/n')

    for i in range(0, N):
        check(i, temp)
        #print(temp)
    #print(temp)
    total_answer+=temp
#print(total_answer)
import collections
dict=collections.Counter(total_answer)
#print(dict)
for i in range(1, N):
    print(dict[i]//2)

Submission status: Wrong Answer

Solution code:
n, x, y = map(int, input().split())
a = [[0 for i in range(n)] for j in range(n)]
for i in range(n-1):
  for j in range(i+1, n):
    if i < x and j >= y-1:
      a[i][j] = j - i - (y - x - 1)
    else:
      a[i][j] = j - i
for i in range(x):
  for j in range(y-2, x-1, -1):
    z = (x + y - 1 - j) - i
    if z < a[i][j]:
      a[i][j] = z
for i in range(y-2, x-1, -1):
  for j in range(y-1, n):
    z = j - (x + y - 3 - i)
    if z < a[i][j]:
      a[i][j] = z
ans = [0 for i in range(n-1)]
for i in range(n-1):
  l = i + 1
  for j in range(0, n-1):
    for k in range(j+1, n):
      if a[j][k] == l:
        ans[i] += 1
for i in ans:
  print(i)

Submission status: Wrong Answer

Solution code:
NXY = list(map(int, input().split()))
N = NXY[0]
X = NXY[1]
Y = NXY[2]

mini = 0
if N-Y<X-1:
    mini = N-Y+1
else:
    mini = X

print(N)

for i in range(4):
    k = i + 2
    if k < Y - X:
        if k<=mini:
            print(N)
        else:
            print(N-k+mini)
    else:
        r = 0
        if k < Y-1:
            r += Y-1-k
            print(r)
        if N-X>k:
            r+=N-X-k
            print(r)
        if N-Y+X>=k:
            print(r+N-Y+X-k+1)
        else:
            print(r)

Submission status: Wrong Answer

Solution code:
N,X,Y = (int(x) for x in input().split())
X -=1
Y-=1
dist = [[0]*N for _ in range(N)]
for i in range(N):
  for j in range(N):
    if i >= j :
      continue
    if i <= X and j >= Y:
      dist[i][j] = j - Y + X - i +1
    elif i <= X and Y >= j > X:
      d1 = j-i
      d2 = X-i + Y-j+1
      dist[i][j] = min(d1,d2)
    elif i>=X and Y <= j:
      d1 = j-i
      d2 = j-Y + i - X + 1
      dist[i][j] = min(d1,d2)
    else:
      dist[i][j] = abs(i-j)
cnt = [0]*(N)
for i in range(N):
  for j in range(N):
    num = dist[i][j]
    if num >0:
      cnt[num] += 1
for i in range(N-1):
  print(cnt[i+1])

Submission status: Wrong Answer

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

cut = Y-X -1

from collections import Counter
D = Counter()

for i in range(1,N):
    D[i] = N-i
    
for i in range(1,X+1):
    D[N-i] -= 1
    D[X-i + cut] +=1
    
for i in range(1,N):
    print(D[i])

Submission status: Wrong Answer

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

min_diff = [[-1] * (n+1) for _ in range(n+1)]
for st in range(1, n+1):
    for go in range(st, n+1):
        min_diff[st][go] = go-st
        if x < st and go < y:
            pass
        elif x >= st and go < y:
            min_diff[st][go] = min(min_diff[st][go], (x-st)+(y-go)+1)
        elif x < st and y <= go:
            min_diff[st][go] = min(min_diff[st][go], (st-x)+(go-y)+1)
        else:
            min_diff[st][go] = min_diff[st][go] - (y-x) + 1

#print(min_diff)

ans = [0] * (n+1)
for i in range(n+1):
    for j in range(n+1):
        ans[min_diff[i][j]] += 1

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

Submission status: Wrong Answer

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)

	for i in range(1,N):
		if i == 1:
			print(N)
			continue
		if i == N-1:
			print(0)
			continue
		if i == N-2:
			print(0)
			continue
		if i == N-3:
			print(0)
			continue
		if i == N-4:
			print(0)
			continue
		if i == N-5:
			print(0)
			continue

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

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





#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# 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: Wrong Answer

Solution code:
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    #return d
a , b , c = map(int,input().split())

n = a
w = a #n:頂点数　w:辺の数

d = [[float("inf")]*n for i in range(n)] 
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(n-1):
    x = i
    y = i+1
    d[x][y] = 1
    d[y][x] = 1
d[b-1][c-1] = 1
d[c-1][b-1] = 1

for i in range(n):
    d[i][i] = 0 #自身のところに行くコストは０
    
warshall_floyd(d)

for i in range(1,n):
    ans = 0
    if i >= b + a - c + 1:
        print(ans)
        continue
    for j in range(n):
        ans += d[j].count(i)
    print(ans//2)

Submission status: Wrong Answer

Solution code:
N,X,Y = [int(i.strip()) for i in input().split(' ')]
X = X-1
Y = Y - 1
diff = (Y-X-1)//2
result = [0]*N
for i in range(N):
    for j in range(i+1,N):
        if i <= X and j >= Y:
            dist = X-i + j - Y +1
        elif i <=X + diff  and j >= Y: 
            dist = diff + 1 + j - Y
        elif i <= X and j >= Y - diff:
            dist = X - i + diff + 1
        elif i <= X + diff and j >= Y - diff:
            if 2*diff + 1 > j - i:
                dist = j - i
            else:
                dist = 2*diff + 1
        else:
            dist = j - i
        result[dist-1] += 1

L = len(result) - 1
for i,j in enumerate(result):
    if not i == L:
        print(j)

Submission status: Wrong Answer

Solution code:
N, X, Y = map(int, input().split())
result = [0] * (N)
for i in range(1, N):
    for j in range(i + 1, N + 1):
        if i <= X and Y <= j:
            len = j - i - (Y - X - 1)
        elif i <= X and X < j < Y and (Y - j + 1) < (j - X):
            len = (Y - j + 1) + (X - i)
        elif X < i < Y and Y <= j and (i - X + 1) < (Y - i):
            len = (i - X + 1) + (j - Y)
        else:
            len = j - i
        result[len] += 1
for i in range(1, N):
    print(result[i])

Submission status: Wrong Answer

Solution code:
import sys
import itertools
from collections import Counter

sys.setrecursionlimit(10**6)

def DFS(i,v,d):
  global dist
  
  if d > N:
    return
  # 頂点vに隣接する頂点でvより大きいものが未発見
  for u in adj[v]:
    # distは最短距離なので上書き禁止
    if i != u and i < u:
      #print(i,u,d)
      if dist[i][u] > d:
        dist[i][u] = d
        dist[u][i] = d
        DFS(i,u,d+1)
    # その先は追加で探索
    elif u in [X-1, Y-1]:
      DFS(i,u,d+1)

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

# 隣接リストを作成する
adj = [[] for _ in range(N)]

# adjに入力
for i in range(N-1):
  adj[i].append(i+1)
  adj[i+1].append(i)

# X,Yをadj入力
adj[X-1].append(Y-1)
adj[Y-1].append(X-1)

# 頂点間の最短距離を保持するdist
dist = [[10**9 for _ in range(N)] for _ in range(N)]
for i in range(N):
  DFS(i,i,1)

  
# print(dist)
# distを１次元化
dist = list(itertools.chain.from_iterable(dist))
c = Counter(dist)

# 結果出力
for k in range(1,N):
  print(c[k]//2)

Submission status: Wrong Answer

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

min_diff = [[-1] * (n+1) for _ in range(n+1)]
for st in range(1, n+1):
    for go in range(st, n+1):
        min_diff[st][go] = go-st
        if x < st and go < y:
            pass
        elif x >= st and go < y:
            min_diff[st][go] = min(min_diff[st][go], (x-st)+(y-go)+1)
        elif x < st and y <= go:
            min_diff[st][go] = min(min_diff[st][go], (st-x)+(go-y)+1)
        else:
            min_diff[st][go] = min_diff[st][go] - (y-x) + 1

print(min_diff)

ans = [0] * (n+1)
for i in range(n+1):
    for j in range(n+1):
        ans[min_diff[i][j]] += 1

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

Submission status: Wrong Answer

Solution code:
n, x, y = map(int, input().split())
x = x-1
y = y-1
from collections import deque
que = deque()

INF = 10**5
seen = [[INF] * n for _ in range(n)]
#import numpy as np
for i in range(n):
    que.append(i)
    seen[i][i] = 0
    #print('---', i)
    while len(que) > 0:
        t = que.popleft()
        step = [t-1, t+1]
        if t == x:
            step.append(y)
        if t == y:
            step.append(x)
        for ti in step:
            #print(ti)
            if ti < i or ti >= n:
                continue
            if seen[i][ti] == INF:
                que.append(ti)
            seen[i][ti] = min(seen[i][t] + 1, seen[i][ti])
    #print(np.array(seen))
#print(np.array(seen))

ans = [0] * n
for i in range(n):
    for j in range(i, n):
        ans[int(seen[i][j])] += 1

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