def build(log_cnt):
    """''Build a structure (a list of truples) that ChiMerge algorithm works properly on it
         return a list like ([0:[6,0]],...) 含义：变量值为0是，非违规6人，违规0人 """
    log_dic = {}
    for record in log_cnt:
        if record[0] not in log_dic.keys():
            log_dic[record[0]] = [0, 0]
        if record[1] == 0:
            log_dic[record[0]][0] = record[2]
        elif record[1] == 1:
            log_dic[record[0]][1] = record[2]
        else:
            raise TypeError('Data Exception')
    log_truple = sorted(log_dic.items())
    return log_truple
