Submission #112739
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; using System.Text; class Program { static void Main(string[] args) { while (true) { List<RainningTimes> rainningTimesList = new List<RainningTimes>(); int N = int.Parse(Console.ReadLine()); for (int i = 0; i < N; i++) { var array = Console.ReadLine().Split('-').Select(int.Parse).ToArray(); int s = array.ElementAtOrDefault(0); int e = array.ElementAtOrDefault(1); int s1 = int.Parse(s.ToString()[s.ToString().Length - 1].ToString()); if (s1 == 0) { } else if (s1 < 5) s -= s1; else if (s1 > 5) s -= s1 - 5; int e1 = int.Parse(e.ToString()[e.ToString().Length - 1].ToString()); if (e1 == 0) { } else if (e1 < 5) e += 5 - e1; else if (e1 > 5) e += 10 - e1; int length = rainningTimesList.Count; for (int j = 0; j < length; j++) { if (JudgeBetween(s, rainningTimesList[j])) { if (JudgeBetween(e, rainningTimesList[j])) { break; } else { rainningTimesList[j].End = e; break; } } else { if (JudgeBetween(e, rainningTimesList[j])) { rainningTimesList[j].Start = s; break; } else if (rainningTimesList[j].Start > s && rainningTimesList[j].End < e) { rainningTimesList[j].Start = s; rainningTimesList[j].End = e; break; } else { rainningTimesList.Add(new RainningTimes(s, e)); break; } } } if (rainningTimesList.Count == 0) rainningTimesList.Add(new RainningTimes(s, e)); } for (int i = rainningTimesList.Count - 1; i >= 0; i--) { int s = rainningTimesList[i].Start; int e = rainningTimesList[i].End; for (int j = i - 1; j >= 0; j--) { if (JudgeBetween(s, rainningTimesList[j])) { if (JudgeBetween(e, rainningTimesList[j])) break; else { rainningTimesList[j].End = e; rainningTimesList.RemoveAt(i); break; } } else { if (JudgeBetween(e, rainningTimesList[j])) { rainningTimesList[j].Start = s; rainningTimesList.RemoveAt(i); break; } else if (rainningTimesList[j].Start > s && rainningTimesList[j].End < e) { rainningTimesList[j].Start = s; rainningTimesList[j].End = e; rainningTimesList.RemoveAt(i); break; } } } } for (int i = 0; i < rainningTimesList.Count; i++) Console.WriteLine(rainningTimesList[i].Start.ToString().PadLeft(4, '0') + "-" + rainningTimesList[i].End.ToString().PadLeft(4, '0')); Console.WriteLine(); } } private static bool JudgeBetween(int time , RainningTimes rainningTimes) { if (rainningTimes.Start <= time && rainningTimes.End >= time) return true; return false; } } class RainningTimes { public int Start, End; public RainningTimes(int start, int end) { Start = start; End = end; } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | pattyo |
Language | C# (Mono 2.10.8.1) |
Score | 0 |
Code Size | 4725 Byte |
Status | RE |
Exec Time | 1520 ms |
Memory | 8140 KB |
Judge Result
Set Name | all | ||
---|---|---|---|
Score / Max Score | 0 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
all | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, cho_cho_chokudai.txt, chokudai_ga_cho.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | RE | 1520 ms | 6404 KB |
00_sample_02.txt | RE | 125 ms | 6372 KB |
00_sample_03.txt | RE | 125 ms | 6360 KB |
cho_cho_chokudai.txt | RE | 250 ms | 6508 KB |
chokudai_ga_cho.txt | RE | 246 ms | 6632 KB |
test_01.txt | RE | 129 ms | 6552 KB |
test_02.txt | RE | 129 ms | 6492 KB |
test_03.txt | RE | 128 ms | 6492 KB |
test_04.txt | RE | 127 ms | 6508 KB |
test_05.txt | RE | 125 ms | 6500 KB |
test_06.txt | RE | 127 ms | 6520 KB |
test_07.txt | RE | 130 ms | 6432 KB |
test_08.txt | RE | 125 ms | 6512 KB |
test_09.txt | RE | 130 ms | 6596 KB |
test_10.txt | RE | 132 ms | 6560 KB |
test_11.txt | RE | 132 ms | 6632 KB |
test_12.txt | RE | 131 ms | 6624 KB |
test_13.txt | RE | 126 ms | 6508 KB |
test_14.txt | RE | 127 ms | 6632 KB |
test_15.txt | RE | 130 ms | 6556 KB |
test_16.txt | RE | 126 ms | 6500 KB |
test_17.txt | RE | 131 ms | 6604 KB |
test_18.txt | RE | 129 ms | 6504 KB |
test_19.txt | RE | 128 ms | 6632 KB |
test_20.txt | RE | 127 ms | 6504 KB |
test_21.txt | RE | 248 ms | 6636 KB |
test_22.txt | RE | 240 ms | 6612 KB |
test_23.txt | RE | 247 ms | 6612 KB |
test_24.txt | RE | 255 ms | 6628 KB |
test_25.txt | RE | 237 ms | 6532 KB |
test_26.txt | RE | 284 ms | 7960 KB |
test_27.txt | RE | 243 ms | 6632 KB |
test_28.txt | RE | 356 ms | 8044 KB |
test_29.txt | RE | 130 ms | 6352 KB |
test_30.txt | RE | 127 ms | 6336 KB |
test_31.txt | RE | 156 ms | 6872 KB |
test_32.txt | RE | 126 ms | 6284 KB |
test_33.txt | RE | 230 ms | 7628 KB |
test_34.txt | RE | 126 ms | 6364 KB |
test_35.txt | RE | 132 ms | 6552 KB |
test_36.txt | RE | 242 ms | 6600 KB |
test_37.txt | RE | 354 ms | 7972 KB |
test_38.txt | RE | 265 ms | 7880 KB |
test_39.txt | RE | 259 ms | 7888 KB |
test_40.txt | RE | 336 ms | 8140 KB |
test_41.txt | RE | 245 ms | 6632 KB |
test_42.txt | RE | 236 ms | 6620 KB |
test_43.txt | RE | 244 ms | 6508 KB |