This commit is contained in:
2022-12-04 17:53:12 -05:00
parent dbdd716f05
commit 687a8ff09d
2 changed files with 5 additions and 3 deletions

View File

@@ -25,7 +25,9 @@ internal class CampCleanup : Problem<int, int>
.Chunk(2) .Chunk(2)
.Select(r => new Range(r.First(), r.Last())) .Select(r => new Range(r.First(), r.Last()))
.First() .First()
).Chunk(2).Select(pair => (pair.First(), pair.Last())).First(); ).Chunk(2)
.Select(pair => (pair.First(), pair.Last()))
.First();
_pairs.Add((a, b)); _pairs.Add((a, b));
} }
} }
@@ -64,6 +66,6 @@ internal class CampCleanup : Problem<int, int>
return (B >= other.A && A <= other.A) || (A <= other.B && B >= other.B) || (A >= other.A && B <= other.B); return (B >= other.A && A <= other.A) || (A <= other.B && B >= other.B) || (A >= other.A && B <= other.B);
} }
public static implicit operator Range((int a, int b) value) => new Range(value.a, value.b); public static implicit operator Range((int a, int b) value) => new (value.a, value.b);
} }
} }

View File

@@ -121,7 +121,7 @@ public class AOCRunner
Console.ForegroundColor = ConsoleColor.Green; Console.ForegroundColor = ConsoleColor.Green;
Console.Write("Done in "); Console.Write("Done in ");
Console.ForegroundColor = ConsoleColor.Cyan; Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine($"{sw.ElapsedMilliseconds}ms"); Console.WriteLine($"{sw.Elapsed.TotalMilliseconds:n}ms");
} }
catch (NotImplementedException) catch (NotImplementedException)
{ {