-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path가희와_탑.py
34 lines (30 loc) · 915 Bytes
/
가희와_탑.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
n,a,b = list(map(int,input().split()))
table = [0]*n
if a+b > n+1:
print(-1)
else:
if a == b:
temp = list(range(1,a)) + list(range(a,0,-1))
for i in range(len(temp)):
table[-i-1] = temp[i]
for i in range(n-(2*a-1)):
table[i] = 1
else:
if a > b:
arrA = list(range(1,a+1))
arrB = list(range(b-1,0,-1))
arr = arrA + arrB
diff = n - len(arr)
table = [1]*diff + arr
else: # a < b
arrB = list(range(b-1,0,-1))
if a != 1:
arrA = list(range(1,a))
arr = arrA + [b] + arrB
diff = n - len(arr)
table = [1]*diff + arr
else:
arrA = [1]*(n-b+1)
arrA[0] = b
table = arrA + arrB
print(' '.join(map(str,table)))