예제 #1
0
        public int NumberOfAdditionalSantas()
        {
            var additionalSantaIds = NonEmptyRoutes.Where(r => OptimizationInput.IsAdditionalSanta(r.SantaId))
                                     .Select(r => r.SantaId)
                                     .Distinct().ToList();

            return(additionalSantaIds.Count);
        }
예제 #2
0
        public int AdditionalSantaWorkTime()
        {
            var additionalSantaIds = NonEmptyRoutes.Where(r => OptimizationInput.IsAdditionalSanta(r.SantaId))
                                     .Select(r => r.SantaId)
                                     .Distinct().ToList();
            var additionalSantaRoutes = NonEmptyRoutes.Where(r => additionalSantaIds.Contains(r.SantaId));

            return(additionalSantaRoutes.Select(r =>
                                                r.Waypoints.Max(wp => wp.StartTime) - r.Waypoints.Min(wp => wp.StartTime))
                   .Sum());
        }