practivceAlgorithm/백준

[백준][Python] 18860 좌표압축

findTheValue 2021. 8. 31. 15:31

set정렬후 이분탐색.

그냥 정렬로도 풀수있나?

 

import sys
input = sys.stdin.readline
from bisect import bisect_left

N = int(input())
arr = list(map(int, input().split()))
arr2  = sorted(list(set(arr)))
for num in arr:
    print(bisect_left(arr2,num),end=' ')