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:
N ,X, Y = map(int, input().split())
 
X -= 1
Y -= 1
k = [0]*N
 
for i in range(N-1):
    for j in range(i+1, N):
        a = j-i
        b = abs(i-X)+1+abs(Y-j)
        m =  min(a, b)
        k[m] += 1
 
for i in range(1, N):
    print(k[i])

Submission status: Accepted

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

X -= 1
Y -= 1
k = [0]*N

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

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

Submission status: Accepted

Solution code:

def solve():
    dists_y = [abs(y-a) for a in range(0,n+1)]
    dists_x = [abs(x-a) for a in range(0,n+1)]
    count_dists = [0]*(n+1)
    for a in range(1,n+1):
        for b in range(1,a+1):
            dis = min(abs(b-a), dists_x[a] + dists_y[b] + 1, dists_y[a] + dists_x[b] + 1)
            count_dists[dis] += 1
    #print(min_dists)
    for j in range(1,n):
        print(count_dists[j])





#
# def ceildiv(a, b):
#     return a // b + a % b



n, x, y = [int(i) for i in input().split(" ")]

# import time
# t = time.time()
#n, x, y = 2000, 200, 600
solve()
#print(time.time()- t)

Submission status: Accepted

Solution code:
import numpy as np

inf = np.iinfo(np.uint32).max



# def solve():
#     dists_y = [abs(y-a) for a in range(0,n+1)]
#     dists_x = [abs(x-a) for a in range(0,n+1)]
#     count_dists = np.zeros(n+1, dtype=int)
#     for a in range(1,n+1):
#         for b in range(1,a+1):
#             dis = min(abs(b-a), dists_x[a] + dists_y[b] + 1, dists_y[a] + dists_x[b] + 1)
#             count_dists[dis] += 1
#     #print(min_dists)
#     for j in range(1,n):
#         print(count_dists[j])

def solve():
    dists_y = [abs(y-a) for a in range(1,n+1)]
    dists_x = [abs(x-a) for a in range(1,n+1)]

    aa = np.tile(np.arange(1, n+1), (n, 1))
    bb = aa.transpose().copy()
    base_dists = np.abs(aa-bb).copy()
    aa = np.tile(dists_y, (n, 1))
    bb = np.tile(dists_x, (n, 1)).transpose().copy()
    ab_dists = aa + bb + 1
    ba_dists = ab_dists.transpose().copy()
    min_dists = np.minimum(ab_dists, ba_dists)
    min_dists = np.minimum(min_dists, base_dists)
    count_dists = np.bincount(min_dists.reshape(n**2))
    for j in range(1,n):
        if j+1>len(count_dists):
            print(0)
        else:
            print(count_dists[j]//2)



#
# def ceildiv(a, b):
#     return a // b + a % b



n, x, y = [int(i) for i in input().split(" ")]

# import time
# t = time.time()
# n, x, y = 2000, 200, 600


solve()
#print(time.time()- t)

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):
		ans[min(j-i,abs(x-i)+abs(y-j)+1,abs(y-i)+abs(x-j)+1)-1]+=1
for _ in ans:
	print(_)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for ans_total in ans_list :
  print(ans_total)

Submission status: Accepted

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

x-=1
y-=1

ans = [0]*n
for i in range(n-1):
    for j in range(i+1,n):
        l = min(j-i, abs(x-i)+1+abs(y-j))
        ans[l]+=1
print('\n'.join(map(str, ans[1:])))

Submission status: Accepted

Solution code:
n, x, y = map(int, input().split())
z = y - x
l = []
for i in range(1, n):
    for j in range(i + 1, n + 1):
        a = min(j - i, abs(x - i) + abs(y - j) + 1)
        l.append(a)

import collections

c = collections.Counter(l)
for i in range(1, n):
    print(c[i])

Submission status: Accepted

Solution code:

if __name__ == "__main__":
    n, x, y = map(int, input().split())
    x -= 1
    y -= 1

    ans = [0] * (n+1)
    for start in range(n):
        for end in range(start + 1, n):
            if (start < x and end < x) or (start > y and end > y):
                ans[end - start] += 1
            
            elif start < x and end >= x and end <= y:
                tmp = x - start
                tmp += min(end - x, y - end + 1)
                ans[tmp] += 1
            
            elif start >= x and start <= y and end > y:
                tmp = end - y
                tmp += min(start - x + 1, y - start)
                ans[tmp] += 1
            
            elif start < x and end > y:
                tmp = x - start + end - y + 1
                ans[tmp] += 1
            
            else:
                ans[min(end - start, start - x + y - end + 1)] += 1
    
    for i in range(1, n):
        print(ans[i])

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

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

c = collections.Counter(L)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
N, X, Y = list(map(int, input().split()))

distance_lis = [0]*(N-1)
for i in range(1, N + 1):
    for j in range(i+1, N + 1):
        # XYを使わない場合
        a = j - i
        b = abs(X - i) + abs(Y - j) + 1
        distance = min(a, b)
        distance_lis[distance-1] += 1
for dis in distance_lis:
    print(dis)

Submission status: Accepted

Solution code:
from collections import deque

n, x, y = map(int, input().split())
dist = [[i - 1, i + 1] for i in range(n)]
dist[0].pop(0)
dist[-1].pop()
dist[x - 1].append(y - 1)
dist[y - 1].append(x - 1)
list = [0] * n

def line(num):
    pos = deque([[num, 0]])
    dp = [-1] * n

    while len(pos) > 0:
        now, depth = pos.popleft()
        dp[num] = 0
        for i in dist[now]:
            if dp[i] > 0:
                continue
            dp[i] = depth + 1
            pos.append([i, depth + 1])
    for i in dp:
        list[i] += 1
for i in range(n):
    line(i)
for i in range(1, n):
    print(int(list[i] / 2))

Submission status: Accepted

Solution code:

N,X,Y = map(int,input().split())
l = [0]*N

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

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

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())

b = b - 1
c = c - 1
A = []

for i in range(a):
    for j in range(i+1, a):
        A.append(min(abs(i - b) + 1 + abs(j - c), abs(j - i)))
import collections
C = collections.Counter(A)

for i in range(1, a):
    print(C[i])

Submission status: Accepted

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

dists = [0] * (n-1)

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

        dists[d-1] += 1

print(*dists, sep='\n')

Submission status: Accepted

Solution code:
N,x,y = map(int, input().split())
long_list=[0 for _ in range(N-1)]

for i in range(1,N):
    for j in range(i+1,N+1):
        a=min(j-i,abs(x-i)+abs(j-y)+1)
        long_list[a-1]=long_list[a-1]+1
for i in long_list:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

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

for k in range(1,N):
    print(data[k])

Submission status: Accepted

Solution code:
import queue
N,X,Y=map(int,input().split())
X-=1
Y-=1
ans=[0]*N
for i in range(N-1):
  for j in range(i+1,N):
    ans[min(j-i, abs(X-i)+1+abs(Y-j))]+=1
for i in range(1,N):
  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):
    for j in range(i+1,n):
        m = min(j-i,abs(i-x)+1+abs(y-j),abs(i-y)+1+abs(j-x))
        ans[m]+=1
for i in range(1,n):print(ans[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque

def solve(N, X, Y):
    ret = [0] * N
    already_used = [[False for _ in range(N + 1)] for _ in range(N + 1)]
    for i in range(1, N + 1):
        already_used[i][i] = True
        reached = [False for _ in range(N + 1)]
        reached[i] = True
        stack = deque([[i, 0]])

        while stack:
            node, step = stack.popleft()
            if 1 <= step and not already_used[i][node]:
               ret[step] += 1
            already_used[i][node], already_used[node][i] = True, True

            for x in [node + 1, node - 1]:
                if 0 < x < N + 1 and not reached[x]:
                    stack.append([x, step + 1])
                    reached[x] = True
            if node == X and not reached[Y]:
                stack.append([Y, step + 1])
                reached[x] = True
            if node == Y and not reached[X]:
                stack.append([X, step + 1])
                reached[x] = True
    return ret

if __name__ == '__main__':
    N, X, Y = map(int, input().split())
    for r in solve(N, X, Y)[1:]:
        print(r)

Submission status: Accepted

Solution code:
from collections import deque, Counter

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

neighbor = [[] for _ in range(n)]

for i in range(n-1):
    neighbor[i].append(i+1)
    neighbor[i+1].append(i)

neighbor[x-1].append(y-1)
neighbor[y-1].append(x-1)

dist = [[-1] * n for _ in range(n)]

for i in range(n):
    d = deque([(i, 0)])
    dist[i][i] = 0

    while len(d) > 0:
        node, length = d.pop()

        for ne in neighbor[node]:
            if dist[i][ne] < 0:
                dist[i][ne] = length + 1
                d.appendleft((ne, length+1))

c = []
for i in range(n):
    c.append(Counter(dist[i]))

for i in range(1, n):
    total = 0
    for j in range(n):
        total += c[j][i]
    print(total // 2)

Submission status: Accepted

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

Submission status: Accepted

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

dp = [0]*N

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

Submission status: Accepted

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

l = [0] * n

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

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

Submission status: Accepted

Solution code:
tmp = list(map(int, input().split()))
n, x, y = tmp
cnt = [0 for k in range(n-1)]

for i in range(n-1):
    for j in range(i+1, n):
        a = j-i
        b = abs(x-i-1) + 1 + abs(j+1-y)
        cnt[min(a,b)-1] += 1

for c in cnt:
    print(c)

Submission status: Accepted

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

from collections import defaultdict
dd = defaultdict(lambda:0)

n, x, y = map(int, input().split())
len_ = [[-1]*(n+1) for _ in range(n+1)]
k = 0
for i in range(1,n+1):
    for j in range(1, n+1):
        if i < j:
            len_[i][j] = min(min(j-i, abs(j-x)+abs(i-y)+1), min(j-i, abs(j-y)+abs(i-x)+1))
            dd[len_[i][j]] += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, x, y = map(int, input().split())
a = [0 for i in range(n)]
for s in range(1, n): #start
    for g in range(s+1, n+1): #goal
        a[min(g-s, abs(x-s)+1+abs(g-y), abs(y-s)+1+abs(g-x))] += 1

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

Submission status: Accepted

Solution code:
from collections import Counter
n,x,y=map(int,input().split())
l=[]
for i in range(n-1):
  for k in range (i+1,n):
      l.append(min(abs(x-1-i)+abs(y-1-k)+1,k-i))
S=Counter(l)
for i in range(1,n):
  print(S[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):
        distance_ij = min(abs(j-i), abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))
        ans[distance_ij-1] += 1

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import collections

def solve(N: int, X: int, Y: int):
    X = X - 1
    Y = Y - 1

    counter = collections.defaultdict(int)
    for i in range(N):
        for j in range(i+1, N):
            k = min(j - i, abs(Y-j) + abs(X-i) + 1)
            counter[k] += 1
    for i in range(1, N):
        print(counter[i])
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(N, X, Y)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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):
		a = min(j-i, abs(x-i)+1+abs(y-j))
		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())
cnt_dist = [0] * (n - 1)
for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        k = min(j - i, abs(x - i) + 1 + abs(j - y))
        cnt_dist[k - 1] += 1
print(*cnt_dist, sep='\n')

Submission status: Accepted

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

# 0スタートに合わせる
x -= 1
y -= 1

# 距離を格納するためのリスト
lengh_list = [0]*n

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

for length in lengh_list[1:]:
    print(length)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import combinations

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

num = []
for i in range(1,n+1):
    num.append(i)

ans = [0] * (n+1)

for i,j in combinations(num,2):
    ans[min(abs(j-i),abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x))] += 1

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

Submission status: Accepted

Solution code:
N,X,Y=map(int,input().split())
X-=1#0-indexへ
Y-=1
dist=[0]*(N+1)
for i in range(N):
  for j in range(i+1,N):
    d=min(j-i,abs(j-X)+1+abs(i-Y),abs(j-Y)+1+abs(i-X))
    #通常ルートとバイパスを通った時を比べて小さい方を取る
    dist[d]+=1#該当の距離に相応するパスの個数を１個追加する
for i in range(1,N):#距離が1以上のパスの個数を順番に出力
  print(dist[i])

Submission status: Accepted

Solution code:
def distance(i,j,x,y):
    return min(j-i,abs(x-i)+abs(y-j)+1,abs(y-i)+abs(x-j)+1)


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

ans=[0]*n
for i in range(1,n+1):
    for j in range(i,n+1):
            ans[distance(i,j,x,y)-1]+=1
for i in range(n-1):
    print(ans[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import deque
from collections import Counter
def main():
    N, X, Y = map(int, input().split())
    graph = {}
    for i in range(N):
        graph[i] = set()
    for i in range(N-1):
        graph[i].add(i+1)
        graph[i+1].add(i)
    graph[X-1].add(Y-1)
    graph[Y-1].add(X-1)

    ans = []
    for i in range(N):
        dist = [-1] * N
        dist[i] = 0
        que = deque([])
        que.append(i)
        while len(que) != 0:
            v = que.popleft()
            for nv in graph[v]:
                if dist[nv] != -1:continue
                dist[nv] = dist[v] + 1
                que.append(nv)
        ans += dist
    ans = Counter(ans)
    for i in range(1, N):
        print(ans[i]//2)
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n,x,y=map(int,input().split())
wk={}
for i in range(1,n+1):
  for j in range(i+1,n+1):
    k=min(j-i,abs(x-i)+1+abs(y-j))
    if k in wk:
      wk[k]+=1
    else:
      wk[k]=1
for i in range(n-1):
  print(wk[i+1] if i+1 in wk else 0)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

disk=[0 for i in range(N-1)]

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

Submission status: Accepted

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

cnt = [0 for i in range(n)]
for i in range(1,n+1):
    for j in range(i+1,n+1):
        dist = min(j-i,abs(x-i)+abs(y-j)+1)
        cnt[dist] += 1

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

Submission status: Accepted

Solution code:
N, X, Y = map(int, input().split())
ans = [0]*(N-1)
for i in range(1, N+1):
    for j in range(i+1, N+1):
        # 使わない場合
        a = abs(j - i)
        # 使う場合
        b = abs(i - X) + abs(j - Y) + 1
        ans[(min(a, b))-1] += 1
for i in ans:
    print(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):
        z = min(j-i, abs(x-i)+abs(j-y)+1, abs(y-i)+abs(j-x)+1)
        ans[z] += 1
for i in range(1,n):
    print(ans[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, X, Y = map(int, input().split())
A = [0] * N
for i in range(1, N):
  for j in range(i + 1, N + 1):
    if i <= X and X < j < Y and (j - i) > (X - i + 1 + (Y - j)):
      t = (X - i + 1 + (Y - j))
      #print(f'{i},{j}/if1:{t}')
    elif X < i < Y and X < j < Y and (j - i) > (i - X + 1 + Y - j):
      t = (i - X + 1 + Y - j)
      #print(f'{i},{j}/if2:{t}')
    elif j >= Y and X <= i < Y and j - i > (i - X + 1 + (j - Y)):
      t = (i - X + 1 + (j - Y))
      #print(f'{i},{j}/if3:{t}')
    elif i <= X and Y <= j:
      t = j - i - (Y - X - 1)
      #print(f'{i},{j}/if4:{t}')
    else:
      t = j - i
      #print(f'{i},{j}/else:{t}')
    A[t] += 1
A.pop(0)
[print(i) for i in A]

Submission status: Accepted

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

import sys
import math

sys.setrecursionlimit(10 ** 6)

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

ans = [0] * (N-1)
for i in range(1, N):
    for j in range(i+1, N+1):
        d = j - i
        d2 = d
        if j>X or i>Y:
            d2 = abs(X-i)+abs(Y-j)+1
        d = min(d,d2)
        ans[d-1] += 1

for d in ans:
    print(d)

Submission status: Accepted

Solution code:
# N,X,Y = (int(i) for i in input().split())
#
#
# NUM = [0] * (N-1)
#
# for i in range(1,N):
#     for j in range(i+1,N+1):
#         num = min(abs(i-j), abs(X-i)+1+abs(Y-j), abs(Y-i) + 1 + abs(X-j))
#         if (num < N):
#             NUM[num-1] += 1
#
#
# for i in range(len(NUM)):
#     print(NUM[i])


def main():
    N,X,Y = (int(i) for i in input().split())


    NUM = [0] * (N-1)

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


    for i in range(len(NUM)):
        print(NUM[i])
    # n, x, y = (int(i) for i in input().split())
    # num_list = [0] * (n - 1)
    # 
    # for i in range(1, n):
    #     for j in range(i + 1, n + 1):
    #         num = min(abs(i - j), abs(x - i) + 1 + abs(y - j), abs(y - i) + 1 + abs(x - j))
    #         if (num < n):
    #             num_list[num - 1] += 1
    # 
    # for i in range(len(num_list)):
    #     print(num_list[i])
        
        
    


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    n, x, y = (int(i) for i in input().split())
    num_list = [0] * (n - 1)

    for i in range(1, n):
        for j in range(i + 1, n + 1):
            num = min(abs(i - j), abs(x - i) + 1 + abs(y - j), abs(y - i) + 1 + abs(x - j))
            if (num < n):
                num_list[num - 1] += 1

    for i in range(len(num_list)):
        print(num_list[i])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
  n,x,y = (int(i) for i in input().split())
  num_list = [0] * (n - 1)

  for i in range(1, n):
    for j in range(i + 1, n + 1):
      num = min(abs(i - j), abs(x - i) + 1 + abs(y - j), abs(y - i) + 1 + abs(x - j))
      if(num < n):
        num_list[num - 1] += 1

  for i in range(len(num_list)):
    print(num_list[i])

if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
N,X,Y = map(int,input().split())
X -= 1
Y -= 1
w = Y - X
dist = [[0] + [1]*(N-1-i) for i in range(N)]

for k in range(Y):
    for r in range(k+1, N):
        old = r - k
        new = abs(X - k) + 1 + abs(Y - r)
        if new < old:
            dist[k][old] -= 1
            dist[k][new] += 1

for i in range(1, N):
    cnt = 0
    for d in dist:
        if i < len(d):
            cnt += d[i]
    print(cnt)

Submission status: Accepted

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

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

for i in ans_list[1:-1]:
    print(i)

Submission status: Accepted

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

dist_cnt = [0] * (n-1)

for i in range(1, n+1):
    for j in range(i+1, n+1):
        dist1 = j - i
        dist2 = abs(x - i) + 1 + abs(y - j)
        dist_cnt[min(dist1, dist2)-1] += 1

for cnt in dist_cnt:
    print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import defaultdict
n, x, y = map(int, input().split())
x -= 1
y -= 1
dd = defaultdict(int)
for i in range(n-1):
    for j in range(i+1, n):
        sp = min(j-i, abs(i-x)+abs(j-y)+1)
        dd[sp] += 1
for i in range(1, n):
    print(dd[i])

Submission status: Accepted

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

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

ans=ans[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-1):
  for j in range(i+1, n):
    d = min(j-i, abs(i-x+1)+abs(j-y+1)+1)
    ans[d-1] += 1

for a in ans:
    print(a)

Submission status: Accepted

Solution code:
from collections import defaultdict

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

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

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

Submission status: Accepted

Solution code:
from collections import defaultdict

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

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

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

Submission status: Accepted

Solution code:
n, x, y = [int(i) for i in input().split()]
# 0 index is 1 distance
result = [0] * (n-1)

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

for ans in result:
	print(ans)


# TLE

# import queue
	
# q = queue.Queue()
# n, x, y = [int(i) for i in input().split()]
# result = [0] * (n-1)

# for p in range(n):
# 	dist_list = [111111] * n
# 	dist = 0
# 	q.put(p)
# 	dist_list[p] = dist 
# 	while not q.empty():
# 		p = q.get()
# 		dist = dist_list[p]
# 		if p+1 < n: 
# 			if dist_list[p+1] > dist:
# 				dist_list[p+1] = dist
# 				q.put(p+1)
# 		if p-1 < n: 
# 			if dist_list[p-1] > dist:
# 				dist_list[p-1] = dist
# 				q.put(p-1)
# 		if p == (x-1): 
# 			if dist_list[y-1] > dist:
# 				dist_list[y-1] = dist
# 				q.put(y-1)
# 		if p == (y-1): 
# 			if dist_list[x-1] > dist:
# 				dist_list[x-1] = dist
# 				q.put(x-1)

# 	for i in dist_list:
# 		if i != 0:
# 			result[i-1] += 1

# for ans in result:
# 	print(ans//2)

Submission status: Accepted

Solution code:
# coding: utf-8
DATA = """
10 4 8
""".split("\n")

def get_debug_line():
	for i in DATA:
		yield i

if 1:
	get_line = input
else:
	get_line = get_debug_line().__next__
	get_line()

N, X, Y = [int(i) for i in get_line().strip().split(" ")]
X-=1
Y-=1
INF = 10 * 20
m = [[0] * N for _ in range(N)]
tt = [0] * N

#print(ret)
#print(len(ret))

for r in range(N):
	for c in range(r+1, N):
		m[r][c] = c - r
		#m[c][r] = m[r][c]
		tt[m[r][c]] += 1
		m[c][r] = m[r][c]

def Set(r, c, v):
	if m[r][c] < v:
		return False
	else:
		tt[m[r][c]] -= 1
		m[r][c] = v
		tt[m[r][c]] += 1
		return True

for r in range(N):
	if not Set(r, Y, m[r][X]+1):
		continue
	for c in range(Y+1, N):
		if not Set(r, c, m[r][c-1]+1):
			break
	for c in range(Y-1, X, -1):
		if not Set(r,c, m[r][c+1]+1):
			break

for t in tt[1:]:
	print (t)

Submission status: Accepted

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

dst = [0 for _ in range(n-1)]
for i in range(1, n+1):
    for j in range(i+1, n+1):
        dst[min(abs(i-j), abs(x-i)+1+abs(y-j))-1] += 1

for d in dst:
    print(d)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, X, Y = map(int, input().split())
X, Y = X-1, Y-1
ans = {i:0 for i in range(1, N)}

for i in range(N-1):
    for j in range(i+1, N):
        d = min(j-i, abs(X-i)+1+abs(Y-j))
        ans[d] += 1
        
for _, v in ans.items():
    print(v)

Submission status: Accepted

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

for i in range(1, n):
  for j in range(i+1, n+1):
    a = j-i
    b = abs(x-i) + abs(y-j) + 1
    countn[min(a, b)-1] += 1
    
for k in range(n-1):
  print(countn[k])