Skip to content

Instantly share code, notes, and snippets.

@Zerumi
Created August 24, 2022 22:28
Show Gist options
  • Save Zerumi/8fdf2280160b2bb78eafd7540417ba8c to your computer and use it in GitHub Desktop.
Save Zerumi/8fdf2280160b2bb78eafd7540417ba8c to your computer and use it in GitHub Desktop.
namespace ege22new
{
internal class Program
{
static void Main(string[] args)
{
int N = 12; // total ids
int[] time = new int[] { 4, 3, 1, 7, 6, 3, 1, 2, 7, 8, 6, 6 };
List<int[]> dependensens = new()
{
new int[] {0},
new int[] {0},
new int[] {1,2},
new int[] {3},
new int[] {3},
new int[] {5},
new int[] {4,6},
new int[] {7},
new int[] {0},
new int[] {0},
new int[] {9},
new int[] {10},
};
for (int i = 0; i < N; i++)
{
int totaltime = time[i];
if (dependensens[i][0] == 0)
{
continue;
}
int maxdeptime = 0;
foreach (var depproc in dependensens[i])
{
maxdeptime = Math.Max(time[depproc - 1], maxdeptime);
}
totaltime += maxdeptime;
time[i] = totaltime;
}
foreach (var item in time)
{
Console.WriteLine(item);
}
Console.WriteLine(time.Max());
}
}
}
@Zerumi
Copy link
Author

Zerumi commented Aug 24, 2022

Решение Демо варианта новой задачи 22 на ЕГЭ по информатике 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment