public Solution(bool timeoutOccured, ESolutionType solutionType, ulong computationsTime, byte[] data) { TimeoutOccured = timeoutOccured; SolutionType = solutionType; ComputationsTime = computationsTime; Data = data; }
public DvrpSolution(DvrpSolutionData result, ulong id, bool timeout_occured, ESolutionType type, ulong computations_time) { data = result; TaskId = id; TimeoutOccured = timeout_occured; SolutionType = type; ComputationsTime = computations_time; }
public static List <int> Run(List <int> a, int d, ESolutionType solutionType) { return(solutionType switch { ESolutionType.My => My(a, d), ESolutionType.Best => Best(a, d), _ => throw new ArgumentOutOfRangeException(nameof(solutionType), solutionType, null) });
public static int Run(int[] arr, ESolutionType solutionType) { return(solutionType switch { ESolutionType.My => My(arr), ESolutionType.Best => Best(arr), _ => throw new ArgumentOutOfRangeException(nameof(solutionType), solutionType, null) });
public static int Run(int steps, string path, ESolutionType solutionType) { return(solutionType switch { ESolutionType.My => My(steps, path), ESolutionType.Best => Best(steps, path), _ => throw new ArgumentOutOfRangeException(nameof(solutionType), solutionType, null) });
public MultiplySolution(int result, ulong id, bool timeout_occured, ESolutionType type, ulong computations_time) { data = new MultiplySolutionData(result); TaskId = id; TimeoutOccured = timeout_occured; SolutionType = type; ComputationsTime = computations_time; }
public static int[] Run(int[] nums, int target, ESolutionType solutionType) { return(solutionType switch { ESolutionType.BruteForce => BruteForce(nums, target), ESolutionType.Dictionary => Dictionary(nums, target), _ => throw new ArgumentOutOfRangeException(nameof(solutionType), solutionType, null) });
public static int Run(int n, List <int> ar, ESolutionType solutionType) { return(solutionType switch { ESolutionType.GroupBy => GroupBy(n, ar), ESolutionType.Loops => Loops(n, ar), ESolutionType.HashSet => HashSet(n, ar), ESolutionType.Lookup => Lookup(n, ar), _ => throw new ArgumentOutOfRangeException(nameof(solutionType), solutionType, null) });
public static int Run(int x, ESolutionType solutionType) { return(solutionType switch { ESolutionType.List => List(x), ESolutionType.WithoutList => WithoutList(x), ESolutionType.Best => Best(x), ESolutionType.MyBest => MyBest(x), _ => throw new ArgumentOutOfRangeException(nameof(solutionType), solutionType, null) });
public void Test(int input, int expectedResult, ESolutionType solutionType) { // Arrange & Act var(result, timeElapsed) = RunWithStopwatch(() => Solution.Run(input, solutionType)); TestContext.Out.WriteLine($"Elapsed={timeElapsed}"); TestContext.Out.WriteLine($"Result={result}"); // Assert Assert.AreEqual(expectedResult, result); }
public void Test(int[] nums, int target, ESolutionType solutionType, int[] expectedResult) { var sw = new Stopwatch(); sw.Start(); // Arrange & Act var result = Solution.Run(nums, target, solutionType); sw.Stop(); TestContext.Out.WriteLine($"Elapsed={sw.ElapsedMilliseconds}"); // Assert Assert.AreEqual(expectedResult, result); }