using System using System Collections Generic using System Linq using

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace графы
{
class Program
{
static void Main(string[] args)
{
int[] I = { 0, 1, 2, 1, 0 };
int[] J = { 1, 2, 3, 3, 2 };
int[] H = {-1,-1,-1,-1};
int[] L = {-1,-1,-1,-1,-1};
//for (int i = 0; i < I.Length; i++)
//{
// Console.WriteLine("Номер дуги {0}, дуга из-в {1}-{2}", i, I[i], J[i]);
//}
//Console.ReadKey();
int i;
for (int k = 0; k < I.Length; k++)
{
i = I[k];
L[k] = H[i];
H[i] = k;
}
for (int a = 0; a < H.Length; a++)
{
Console.WriteLine(H[a]);
}
Console.WriteLine();
for (int b = 0; b < L.Length; b++)
{
Console.WriteLine(L[b]);
}
Console.ReadKey();
}
}
}