Something that does not give me swift feedback is not interesting/attractive.
It's surprising that I'm allowed to modify both ind
and
c
. Anyting can be done with that power.
Duplicate indices will be ignored except for the first one, so I can
reduce the ind
array with unique elements.
Fill the unique indices with characters from the lexicographically smallest one.
for _ in range(int(input())):
n, m = map(int, input().split())
s: list[str] = list(input())
ind: list[int] = list(map(int, input().split()))
c: list[str] = list(input())
unique_ind: list[int] = list(set(ind))
unique_ind.sort()
c.sort()
for i in range(len(unique_ind)):
s[unique_ind[i] - 1] = c[i]
print("".join(s))
Ketone not measured yet mg/dl
Salad 100g Protein shake 10g
Total carbohydrate 110 g
MUST:
TODO: