나의 답안

def solution(id_list, report, k):
    answer = {i:[0] for i in id_list}
    data = {i:[0] for i in id_list}
    
    for i, cur in enumerate(report):
        x, y = cur.split(" ")
        if x not in data[y]:
            data[y][0] += 1
            data[y].append(x)
    
    
    for i in data.values():
        if i[0] >= k:
            for j in i[1:]:
                answer[j].append(1)

    real = []
    for i in answer.values():
        real.append(sum(i))
    
    return real

+ Recent posts