백준. 18870번. 좌표 압축 파이썬 풀이

minan·2021년 7월 1일
0

백준

목록 보기
14/35

백준. 18870번. 좌표 압축 파이썬 풀이

문제링크 https://www.acmicpc.net/problem/18870

딕셔너리를 이용하여 인덱스 저장

n = int(input())

array = list(map(int, input().split()))

temp = list(set(array))
temp = sorted(temp)

dic = {}

for i in range(len(temp)):
    dic[temp[i]] = i

for point in array:
    print(dic[point], end=' ')
profile
https://github.com/minhaaan

0개의 댓글

관련 채용 정보