def id2trc(s_id, grid_dim):
    """
    Convert state id to row, col, cell type
    """
    t = s_id // (grid_dim[0] * grid_dim[1])
    r = (s_id - t * grid_dim[0] * grid_dim[1]) // grid_dim[1]
    c = (s_id - t * grid_dim[0] * grid_dim[1] - r * grid_dim[1]) // 1
    return t, r, c