from typing import List


def one_hot_encode(total: int, positions: List[int]):
    """Compute one-hot encoding of a list of positions (ones) in
    a vector of length 'total'."""
    lst = [0 for _ in range(total)]
    for position in positions:
        assert position <= total, "index out of bounds"
        lst[position] = 1
    return lst