백준문제풀이/정렬

18870 (다시풀기)

포비용 2023. 1. 28. 18:46
import sys


sys.stdin = open("input.txt","rt")

n = int(input())

lists = list(map(int, input().split()))
copy_list = lists.copy()

lists.sort()

tmp_dic = {}

for k in lists:
    tmp_dic[k] = lists.index(k)


for j in copy_list:
    for i in tmp_dic.items():
        if j == i[0]:
            j = i[1]
            print(j, end = " ")
            
            
 --------------------------------------
 
 #수정 정답임
 
 import sys

sys.stdin = open("input.txt","rt")

n = int(input())

lists = list(map(int, input().split()))
set_lists = list(set(lists.copy()))


set_lists.sort()

new_dict = {}

for i in range(len(set_lists)):
    new_dict[set_lists[i]] = i

# print(new_dict)



for x in lists:
    print(new_dict[x], end = " ")