tuple route
{
key int r;
{int} s1;
{int} s2;
}
{route} Routes ={
<1,{1,3},{8,5}>,
<2,{2,3},{7,9}>
};
sorted {int} indexes1={i.r | i in Routes};
sorted {int} indexes2=union (i in Routes) i.s1;
int res[i in indexes1][j in indexes2]=(j in item(Routes,<i>).s1)
?item(item(Routes,<i>).s2,ord(item(Routes,<i>).s1,j))
:0;
execute
{
writeln(indexes1);
writeln(indexes2);
writeln(res);
}
т
{1 2}
{1 2 3}
[[8 0 5]
[0 7 9]]