20241217 ◎

Review: 2044D. Harder Problem - 1000

Codeforces Round 993 (Div. 4) Editorial

Observe that if you have an array where all elements are unique, they will all have frequency 1, therefore they can all be classified as the mode.

!!!(・⊿・)!!!

Here is my solution.

for _ in range(int(input())):
    n: int = int(input())
    a: list[int] = list(map(int, input().split()))

    s: set[int] = set()
    j: int = 1
    b: list[int] = []
    for i in range(n):
        if a[i] not in s:
            b.append(a[i])
            s.add(a[i])
        else:
            while j in s:
                j += 1
            b.append(j)
            s.add(j)
    print(" ".join([str(x) for x in b]))

_ lb

bench press, lat pull down, 60 minutes jog


TODO:


index 20241216 20241218