Submission #626433
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { struct time { internal int starttime; internal int endtime; } static void Main() { FindAnswer(); } public static string IntToString(int time) { string ChangedTime = String.Empty; if (time < 10) ChangedTime = "000" + time.ToString(); else if (time < 60) ChangedTime = "00" + time.ToString(); else if (time < 1000) ChangedTime = "0" + time.ToString(); else ChangedTime = time.ToString(); return ChangedTime; } public static void FindAnswer() { int element_count = int.Parse(Console.ReadLine()); string[] arrTime = new string[element_count]; List<time> timeList = new List<time>(); //入力 List<time> AnswerList = new List<time>(); //答え for (int i = 0; i < element_count; i++) { arrTime[i] = Console.ReadLine(); } foreach (string time in arrTime) { string[] s = time.Split('-'); int start = int.Parse(s[0]); int end = int.Parse(s[1]); time input = new time(); start -= start % 5; if (end % 5 == 0) { //do nithing } else { end += (5 - (end % 5)); if (end % 100 == 60) end += 40; } input.starttime = start; input.endtime = end; timeList.Add(input); } timeList.Sort(delegate(time a, time b) { return a.starttime - b.starttime; }); int ansStart = timeList[0].starttime; int ansEnd = timeList[0].endtime; int count = 0; foreach (time time in timeList) { if (time.starttime <= ansEnd && ansEnd <= time.endtime) { ansEnd = time.endtime; if (count == timeList.Count() - 1) Console.WriteLine(ansStart.ToString("0000") + "-" + ansEnd.ToString("0000")); } else if (ansEnd < time.starttime) { Console.WriteLine(ansStart.ToString("0000") + "-" + ansEnd.ToString("0000")); ansStart = time.starttime; ansEnd = time.endtime; if (count == timeList.Count() - 1) Console.WriteLine(ansStart.ToString("0000") + "-" + ansEnd.ToString("0000")); } else { if (count == timeList.Count() - 1) Console.WriteLine(ansStart.ToString("0000") + "-" + ansEnd.ToString("0000")); } count++; } } } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | cyaozu |
Language | C# (Mono 2.10.8.1) |
Score | 100 |
Code Size | 3140 Byte |
Status | AC |
Exec Time | 207 ms |
Memory | 11880 KB |
Judge Result
Set Name | all | ||
---|---|---|---|
Score / Max Score | 100 / 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 | AC | 200 ms | 8732 KB |
00_sample_02.txt | AC | 132 ms | 8664 KB |
00_sample_03.txt | AC | 132 ms | 8700 KB |
cho_cho_chokudai.txt | AC | 184 ms | 11876 KB |
chokudai_ga_cho.txt | AC | 181 ms | 11808 KB |
test_01.txt | AC | 133 ms | 8824 KB |
test_02.txt | AC | 136 ms | 8900 KB |
test_03.txt | AC | 136 ms | 8812 KB |
test_04.txt | AC | 141 ms | 8812 KB |
test_05.txt | AC | 147 ms | 8864 KB |
test_06.txt | AC | 133 ms | 8688 KB |
test_07.txt | AC | 133 ms | 8692 KB |
test_08.txt | AC | 136 ms | 8684 KB |
test_09.txt | AC | 134 ms | 8824 KB |
test_10.txt | AC | 151 ms | 8824 KB |
test_11.txt | AC | 153 ms | 8828 KB |
test_12.txt | AC | 152 ms | 8696 KB |
test_13.txt | AC | 141 ms | 8684 KB |
test_14.txt | AC | 155 ms | 8940 KB |
test_15.txt | AC | 160 ms | 8824 KB |
test_16.txt | AC | 137 ms | 8740 KB |
test_17.txt | AC | 134 ms | 8824 KB |
test_18.txt | AC | 136 ms | 8744 KB |
test_19.txt | AC | 157 ms | 8780 KB |
test_20.txt | AC | 136 ms | 8856 KB |
test_21.txt | AC | 181 ms | 11784 KB |
test_22.txt | AC | 180 ms | 11820 KB |
test_23.txt | AC | 181 ms | 11760 KB |
test_24.txt | AC | 180 ms | 11852 KB |
test_25.txt | AC | 183 ms | 11812 KB |
test_26.txt | AC | 178 ms | 11800 KB |
test_27.txt | AC | 182 ms | 11764 KB |
test_28.txt | AC | 180 ms | 11880 KB |
test_29.txt | AC | 131 ms | 8708 KB |
test_30.txt | AC | 138 ms | 8692 KB |
test_31.txt | AC | 138 ms | 9328 KB |
test_32.txt | AC | 131 ms | 8724 KB |
test_33.txt | AC | 176 ms | 11252 KB |
test_34.txt | AC | 135 ms | 8696 KB |
test_35.txt | AC | 162 ms | 8776 KB |
test_36.txt | AC | 195 ms | 11768 KB |
test_37.txt | AC | 207 ms | 11768 KB |
test_38.txt | AC | 189 ms | 11772 KB |
test_39.txt | AC | 206 ms | 11768 KB |
test_40.txt | AC | 183 ms | 11752 KB |
test_41.txt | AC | 187 ms | 11764 KB |
test_42.txt | AC | 178 ms | 11796 KB |
test_43.txt | AC | 174 ms | 11808 KB |