//enum TrainStates { TrainIsReadyInA, TrainIsReadyInB, TrainIsLeavingA, TrainIsLeavingB } //static int CA { set; get; } static void Main(string[] args) { int time = System.Environment.TickCount; TextReader r = new StreamReader("input.txt"); int N = int.Parse(r.ReadLine()); for (int n = 1; n <= N; n++) { int turnaround = int.Parse(r.ReadLine()); string[] nums = r.ReadLine().Split(' '); int NA = int.Parse(nums[0]); int NB = int.Parse(nums[1]); var events = new List <TrainState>(); var AStation = new TrainStation(); var BStation = new TrainStation(); for (int i = 0; i < NA + NB; i++) { string[] times = r.ReadLine().Split(' '); int t = 0; t = int.Parse(times[0].Replace(":", "")); t = t % 100 + (t / 100) * 60; events.Add(new TrainIsLeaving(i < NA ? AStation : BStation, t)); t = int.Parse(times[1].Replace(":", "")); t = t % 100 + (t / 100) * 60; events.Add(new TrainIsReady(i < NA ? BStation : AStation, t + turnaround)); } events.Sort(); foreach (TrainState state in events) { state.Process(); } Console.WriteLine("Case #{0}: {1} {2}", n, -AStation.Minimum, -BStation.Minimum); } //Console.ReadLine(); }
protected TrainState(TrainStation station, int time, int priority) { this.Time = time; this.Station = station; this.Priority = priority; }
public TrainIsReady(TrainStation station, int time) : base(station, time, 1) { }
public TrainIsLeaving(TrainStation station, int time) : base(station, time, 5) { }