import torch


def dimacs_challenge_dist_fn(i: torch.Tensor, j: torch.Tensor, scale: int = 100,) -> torch.Tensor:
    """
    times/distances are obtained from the location coordinates,
    by computing the Euclidean distances truncated to one
    decimal place:
    $d_{ij} = \frac{\floor{10e_{ij}}}{10}$
    where $e_{ij}$ is the Euclidean distance between locations i and j

    coords*100 since they were normalized to [0, 1]
    """
    return torch.floor(10*torch.sqrt(((scale*(i - j))**2).sum(dim=-1)))/10